Skip to content

fix(core): avoid confusion between let value and internal data structures - #59694

Open
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:59504/let-container
Open

crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:59504/let-container

Conversation

@crisbeto

Copy link
Copy Markdown
Member

Currently we store the value of @let directly on the LView. This can be problematic for hydration, because the user could define a value for the @let that looks like an internal data structure, e.g. LView is just an array with a specific shape, which would in turn lead to undefined behavior.

These changes wrap the value in a container so that we can disambiguate it from internal data structures.

Fixes #59504.

…ures

Currently we store the value of `@let` directly on the `LView`. This can be problematic for hydration, because the user could define a value for the `@let` that looks like an internal data structure, e.g. `LView` is just an array with a specific shape, which would in turn lead to undefined behavior.

These changes wrap the value in a container so that we can disambiguate it from internal data structures.

Fixes angular#59504.
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Jan 24, 2025
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Jan 24, 2025
@ngbot ngbot Bot added this to the Backlog milestone Jan 24, 2025
@crisbeto
crisbeto marked this pull request as ready for review January 24, 2025 09:10
@pkozlowski-opensource pkozlowski-opensource self-assigned this Jan 24, 2025
@diesieben07

Copy link
Copy Markdown

I just ran into this. While it is easy to work around, the error message is most perplexing! It would be nice to get this fixed.

@thePunderWoman
thePunderWoman removed the request for review from pkozlowski-opensource July 3, 2025 11:29
@csutorasr

Copy link
Copy Markdown

I think this PR can be closed. The problem, that it fixes, no longer exists in Angular 20.

@ghost

ghost commented Aug 29, 2026

Copy link
Copy Markdown

i want to close pull request

@crisbeto

Copy link
Copy Markdown
Member Author

The test I introduced here passes at head, but I see this in the logs which looks like an error that's being swallowed somewhere:

TypeError: Cannot create property 'i18nNodes' on number '1'
    at cleanupI18nHydrationData (./packages/core/src/hydration/i18n.ts:661:28)
    at cleanupLView (./packages/core/src/hydration/cleanup.ts:111:3)
    at cleanupLView (./packages/core/src/hydration/cleanup.ts:120:7)
    at cleanupDehydratedViews (./packages/core/src/hydration/cleanup.ts:137:9)
    at ./packages/core/src/hydration/api.ts:289:17
    at _ZoneDelegate.invoke (/private/var/tmp/_bazel_kkostadinov/003b62d2e7b494adc222a58ec2b88b62/sandbox/darwin-sandbox/2200/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/packages/platform-server/test/test_/test.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/zone.js/fesm2015/zone.js:358:158)
    at _ZoneImpl.run (/private/var/tmp/_bazel_kkostadinov/003b62d2e7b494adc222a58ec2b88b62/sandbox/darwin-sandbox/2200/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/packages/platform-server/test/test_/test.runfiles/_main/node_modules/.aspect_rules_js/[email protected]/node_modules/zone.js/fesm2015/zone.js:127:35)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Certain @let values can mimic internal data structure, breaking basic runtime logic

4 participants