-
Notifications
You must be signed in to change notification settings - Fork 26k
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
Handle const enums in HMR replacement function #59815
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…l evaluator Fixes that the partial evaluator was interpreting initializer-less enum members as undefined. In this case the value is the same as the index.
When we generate an HMR replacement function, we determine which locals from the file are used and we pass them by reference. This works fine in most cases, but breaks down for const enums which don't have a runtime representation. These changes work around the issue by passing in all the values as an object literal. Fixes angular#59800.
…d through Adds some logic so that if we can't produce a runtime representation of an enum, the dev server can fall back to refreshing the page.
AndrewKushnir
approved these changes
Jan 31, 2025
|
This PR was merged into the repository by commit a971360. The changes were merged into the following branches: main, 19.1.x |
alxhub
pushed a commit
that referenced
this pull request
Feb 3, 2025
When we generate an HMR replacement function, we determine which locals from the file are used and we pass them by reference. This works fine in most cases, but breaks down for const enums which don't have a runtime representation. These changes work around the issue by passing in all the values as an object literal. Fixes #59800. PR Close #59815
alxhub
pushed a commit
that referenced
this pull request
Feb 3, 2025
When we generate an HMR replacement function, we determine which locals from the file are used and we pass them by reference. This works fine in most cases, but breaks down for const enums which don't have a runtime representation. These changes work around the issue by passing in all the values as an object literal. Fixes #59800. PR Close #59815
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
…l evaluator (angular#59815) Fixes that the partial evaluator was interpreting initializer-less enum members as undefined. In this case the value is the same as the index. PR Close angular#59815
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
…9815) When we generate an HMR replacement function, we determine which locals from the file are used and we pass them by reference. This works fine in most cases, but breaks down for const enums which don't have a runtime representation. These changes work around the issue by passing in all the values as an object literal. Fixes angular#59800. PR Close angular#59815
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
…d through (angular#59815) Adds some logic so that if we can't produce a runtime representation of an enum, the dev server can fall back to refreshing the page. PR Close angular#59815
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
action: merge
The PR is ready for merge by the caretaker
area: compiler
Issues related to `ngc`, Angular's template compiler
target: patch
This PR is targeted for the next patch release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Includes the following changes that allow us to generate HMR replacement functions that depend on const enums.
fix(compiler-cli): handle enum members without initializers in partial evaluator
Fixes that the partial evaluator was interpreting initializer-less enum members as undefined. In this case the value is the same as the index.
fix(compiler-cli): handle const enums used inside HMR data
When we generate an HMR replacement function, we determine which locals from the file are used and we pass them by reference. This works fine in most cases, but breaks down for const enums which don't have a runtime representation.
These changes work around the issue by passing in all the values as an object literal.
fix(compiler-cli): gracefully fall back if const enum cannot be passed through
Adds some logic so that if we can't produce a runtime representation of an enum, the dev server can fall back to refreshing the page.
Fixes #59800.