Repository navigation
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Angular migrations guide (https://angular.dev/reference/migrations/outputs) suggests to migrate @Output decorators to output functions.
Though it brings in NG0953 errors if output is used after component is destroyed (see #19826 )
NG0953 is not anyhow mentioned in https://angular.dev/reference/migrations/outputs
There's no such page as https://angular.dev/errors/NG0953
Is is not easy to catch these errors after migration (especially if you do not expect them)
This error can be indication of a memory leak or a performance issue but doesn't cause any unexpected behavior
So what I can suggest:
- Improve documentation
- Make NG0953 configurable for example via
extendedDiagnostics - From my understanding NG0953 is also emitted in some other cases so probably this specific case should have a dedicated error?
Please provide a link to a minimal reproduction of the bug
No response
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.7
Node: 22.11.0
Package Manager: yarn 4.6.0
OS: win32 x64
Angular: 19.1.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1901.7
@angular-devkit/build-angular 19.1.7
@angular-devkit/core 19.1.7
@angular-devkit/schematics 19.1.7
@angular/cdk 19.1.4
@angular/cli 19.1.7
@schematics/angular 19.1.7
rxjs 7.8.2
typescript 5.7.3
webpack 5.98.0
zone.js 0.15.0
Anything else?
P.S. For example unexpected crash on animation done event after component is destroyed (not trivial to resolve btw):
@HostListener('@flyInOut.done')
onAnimationEnd() {
this.animationDone.emit(this.state);
}
Activity
JeanMeche commentedon Feb 26, 2025
Hi, extended diagnostics are a compile time feature while this error is a runtime one.
The error is somehow correct and warns you that nothing was emmited.
It is directly due to #19826 (the
OutputEmitterRefis destroyed withDestroyRef).sherlock1982 commentedon Feb 26, 2025
Should it become a warning instead of an unhandled error? Or somehow configurable? I saw that some runtime errors can be configured via injection parameters.
I didn't expect my app to crash when I migrated from
@OutputdecoratorsNateRadebaugh commentedon Feb 26, 2025
The question is: "warns you that nothing was emitted" is a big deal and cause for concern/fixing, or whether it can be safely ignored?
In the
@Outputdecorators path, I imagine we have the same "issue" but no warning, and our apps are running as expected. I'm not sure the value added by "warning" via an explicit error, especially for the migration of existing code.sherlock1982 commentedon Feb 26, 2025
It depends on the app and developer if it is a big deal or not.
It might be a signal that something is not properly unsubscribed. So overall to me this is a good development warning but not a crash of course.
JeanMeche commentedon Mar 9, 2025
We discussed it with the team, we'll make it a warning in the next patch release.
refactor(core): log a warning instead of throwing error on `OutputRef…
refactor(core): log a warning instead of throwing error on `OutputRef…
ahmad-moussawi commentedon Mar 25, 2025
I have a similar case, I have a popover that shows/disappears on mouse over, and the component emits a message when the data inside the popover loads, I see this error if the user hovers over the element and moves out quickly.
adam-marshall commentedon Apr 3, 2025
I'm still not sure making it a warning is desirable, unless I'm using it incorrectly?
E.g. I have an overlay for selecting items, when you select an item the
outputemits, and the overlay is destroyed. Everything is working as expected, aside from the error/warning.Should there be some kind of option or implicit way of saying "I know what I'm doing, I expect this to emit once and then be destroyed"?
Or is there another mechanism for handling this?
angular-automatic-lock-bot commentedon May 4, 2025
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.