Handle const enums in HMR replacement function#59815
Closed
crisbeto wants to merge 3 commits intoangular:mainfrom
Closed
Handle const enums in HMR replacement function#59815crisbeto wants to merge 3 commits intoangular:mainfrom
crisbeto wants to merge 3 commits intoangular:mainfrom
Conversation
…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
Member
|
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. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.