-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: event dispatchstate: has PR
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
In an SSR Angular app with withEventReplay() enabled and a lot of elements to hydrate, components can be interacted with before hydration ends.
In that case, if a component is destroyed by a click happening on it (because it triggers a router navigation for example) before hydration completes, the click event on that element will be replayed even though the element is already destroyed.
This behavior makes the app throw errors like NG0953 if the click listener emits to an output for example.
Please provide a link to a minimal reproduction of the bug
https://github.com/jsaguet/ng0953-ssr
Please provide the exception or error you saw
NG0953: Unexpected emit for destroyed `OutputRef`. The owning directive/component is destroyed.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 19.1.5
Node: 22.13.0
Package Manager: npm 10.9.2
OS: win32 x64
Angular: 19.1.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1901.5
@angular-devkit/build-angular 19.1.5
@angular-devkit/core 19.1.5
@angular-devkit/schematics 19.1.5
@angular/cli 19.1.5
@angular/ssr 19.1.5
@schematics/angular 19.1.5
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
Anything else?
In the repro app, you need to click on the square to make it disappear, the error NG0953 should happen at the end of the artificial 2s delay, when hydration ends.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: event dispatchstate: has PR