Skip to content

HMR attempts to restore values for inputs of type "file" #22084

@klocus

Description

@klocus

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

Description

When we use HMR, this one tries to restore values for fields after reloading. Unfortunately, it also tries to do this for inputs of type file, which it should not do. Only the user can update a value of this type. This causes the browser to report the error.

🔬 Minimal Reproduction

ng serve --hmr

🔥 Exception or Error

Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

🌍 Your Environment

Angular CLI: 12.1.0
Node: 14.17.4
Package Manager: npm 7.21.1
OS: darwin x64

Angular: 12.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.0
@angular-devkit/build-angular   12.1.0
@angular-devkit/core            12.1.0
@angular-devkit/schematics      12.1.0
@schematics/angular             12.1.0
rxjs                            6.6.3
typescript                      4.3.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions