Repository navigation
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimearea: serverIssues related to server-side renderingIssues related to server-side renderingcore: hydrationstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
hi sir,
Hope you have a good day.
As this issue #51157, it seem work with normal angular application. I try to reproduce it but I get fail so this repo is fine: https://codesandbox.io/p/sandbox/relaxed-feather-27fv8y.
Video deleted
I can give the context, and you can skip my stupid English Voice explain :D
Step
- I try to achieve dynamic html content render by ngx-dynamic-hook. It work, but as the last time, it still have flick. I try to revert everything, event use the deleted angular/core package but it still flick.
- I decided to do native render instead of using library and get error.
- try to debug it and get this value is true, while I think it should not be this boolean value.

- the lView variable here looks like have an unexpected item which have boolean value.

- the clue lead to this function, some how it not working.

Question
- So the question is, at which condition something I code become boolean value? If I can answer that. maybe I can track the real html or ts code I wrote have transform to boolean and I can make a reproduce repository.
I think that all. After that I will try it again and see the reason why it still flicks on dynamic render.
Please provide a link to a minimal reproduction of the bug
I try to reproduce it but I get fail so this repo is fine: https://codesandbox.io/p/sandbox/relaxed-feather-27fv8y
Please provide the exception or error you saw
TypeError: Cannot create property 'ssrId' on boolean 'true'
at getSsrId (./node_modules/@angular/core/fesm2022/core.mjs:30711:20)
at serializeLContainer (./node_modules/@angular/core/fesm2022/core.mjs:30831:24)
at serializeLView (./node_modules/@angular/core/fesm2022/core.mjs:30969:46)
at annotateHostElementForHydration (./node_modules/@angular/core/fesm2022/core.mjs:31087:21)
at annotateComponentLViewForHydration (./node_modules/@angular/core/fesm2022/core.mjs:30733:16)
at annotateForHydration (./node_modules/@angular/core/fesm2022/core.mjs:30789:17)
at <anonymous> (./node_modules/@angular/platform-server/fesm2022/platform-server.mjs:16568:30)
at Generator.next (<anonymous>)
at asyncGeneratorStep (./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:3:1)
at _next (./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:22:1)
Angular is running in development mode.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 16.1.8
Node: 18.15.0
Package Manager: npm 9.5.0
OS: win32 x64
Angular: 16.2.0
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1601.8
@angular-devkit/build-angular 16.1.8
@angular-devkit/core 16.1.8
@angular-devkit/schematics 16.1.8
@angular/cli 16.1.8
@nguniversal/builders 16.1.3
@nguniversal/express-engine 16.1.3
@schematics/angular 16.1.8
rxjs 7.8.1
typescript 4.9.5
webpack 5.88.1
zone.js 0.13.1
Anything else?
Thank you so much for you support
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimearea: serverIssues related to server-side renderingIssues related to server-side renderingcore: hydrationstate: has PR
Activity
AndrewKushnir commentedon Aug 11, 2023
@hiepxanh thanks for reporting the issue and providing the details 👍
I was able to reproduce the problem and it happens in a scenario where both root component and child components inject
ViewContainerRef. This causes an update in internal data structures which the current hydration logic doesn't account for. The situation is similar to #51157, just happens at a different location.Here is a setup that causes the problem:
I've identified the root cause in the code as well and will work on a fix. Will keep this thread updated.
Thank you.
hiepxanh commentedon Aug 11, 2023
Thank you so much sir, that very nice. Glad that I can help
AndrewKushnir commentedon Aug 23, 2023
Hi @hiepxanh, just wanted to let you know that I've created a draft PR #51456 with a proposed fix for the issue that you reported in this ticket.
You can test (locally) if this fix resolves the problem that you've mentioned by using build artifacts from the PR. You can try updating your
package.jsonfile, change the@angular/corepackage reference and runningnpm install --force:Note: this archive is available only temporarily, please do not use it in production builds.
Thank you.
hiepxanh commentedon Aug 23, 2023
Aw, thank you so much sir, look like we did it! We were going through the root of the issue and fixing it. The above is code rendered by ngx-dynamic-hooks and looks like it uses angular core 13 version which should not work. The below one using angular core and render directly.
Congratulations sir. Thank you so much.
hiepxanh commentedon Aug 24, 2023
hi @AndrewKushnir, thank you so much for your support. I already try with ngx-dynamic-hook and his response is, it still using latest angular core in the node_modules. And because he meantion that he use render but tthis one use renderer and look like it still cause the flick. So I decide to write my own work and wish your help.
I created new issue here
#51491
fix(core): handle hydration of view containers that use component hos…
fix(core): handle hydration of view containers that use component hos…
angular-automatic-lock-bot commentedon Sep 29, 2023
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.
fix(core): handle hydration of view containers that use component hos…
fix(core): handle hydration of view containers that use component hos…