Repository navigation
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: i18nIssues related to localization and internationalizationcore: hydrationstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
When tagging nodes with i18n, if the tagged element is projected using content projection, but disconnected from the DOM, hydration will break on the client side with this error:
ERROR Error: ASSERTION ERROR: Expected root i18n node during hydration [Expected=> null != null <=Actual]
Example code:
@Component({
imports: [NgIf],
selector: 'app-projected',
template: `
<ng-container *ngIf="false"> <!-- works if true -->
<ng-content></ng-content>
</ng-container>
`,
standalone: true,
})
export class ProjectedComponent {}<app-projected>
<div i18n>This content is not projected</div>
</app-projected>The error also occurs if the i18n tag is on the component containing the content projection (in this case, app-projected)
Seems similar to #57105, in that there is no root node because the component can't/shouldn't be hydrated.
Please provide a link to a minimal reproduction of the bug
https://github.com/henry-alakazhang/angular-i18n-skiphydration-repro (last example)
Please provide the exception or error you saw
ERROR Error: ASSERTION ERROR: Expected root i18n node during hydration [Expected=> null != null <=Actual]
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 18.1.1
Node: 18.20.3
Package Manager: yarn 1.22.19
OS: darwin arm64
Angular: 18.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router, ssr
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1801.1
@angular-devkit/build-angular 18.1.1
@angular-devkit/core 18.1.1
@angular-devkit/schematics 18.1.1
@schematics/angular 18.1.1
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.8
Anything else?
No response
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: i18nIssues related to localization and internationalizationcore: hydrationstate: has PR
Activity
fix(core): skip hydration for i18n nodes that were not projected
AndrewKushnir commentedon Aug 13, 2024
@henry-alakazhang thanks for reporting the issue and providing a repro. I've created PR #57356 with the fix. The PR will go through code review and testing procedures and will be included into one of the upcoming releases.
fix(core): skip hydration for i18n nodes that were not projected (#57356
fix(core): skip hydration for i18n nodes that were not projected (#57356
fix(core): skip hydration for i18n nodes that were not projected (ang…
fix(core): skip hydration for i18n nodes that were not projected (ang…
angular-automatic-lock-bot commentedon Sep 13, 2024
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.