Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 15 tasks
klocus opened this issue Nov 4, 2021 · 4 comments · Fixed by #22086
Closed
1 of 15 tasks

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

klocus opened this issue Nov 4, 2021 · 4 comments · Fixed by #22086

Comments

@klocus
Copy link

klocus commented Nov 4, 2021

🐞 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
@ngbot ngbot bot modified the milestone: Backlog Nov 4, 2021
clydin pushed a commit that referenced this issue Nov 4, 2021
…le` during HMR

```
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.
```

Closes #22084
clydin pushed a commit that referenced this issue Nov 4, 2021
…le` during HMR

```
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.
```

Closes #22084

(cherry picked from commit 47fd128)
@sebastian-zarzycki-apzumi

Isn't this fix going to result with "[NG HMR] Unknown input type" warnings for file inputs?

@alan-agius4
Copy link
Collaborator

Good catch @sebastian-zarzycki-es

@alan-agius4
Copy link
Collaborator

@sebastian-zarzycki-es #22092

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants