refactor(core): Removes unused flag for onDestroy

Eliminates an unnecessary configuration flag

(cherry picked from commit 2ad1b5979f)
This commit is contained in:
SkyZeroZx 2025-11-01 16:50:26 -05:00 committed by Andrew Scott
parent 3140b87fd6
commit 36f4c9b299

View file

@ -12,8 +12,6 @@ import {LView} from '../render3/interfaces/view';
import {getLView} from '../render3/state';
import {removeLViewOnDestroy, storeLViewOnDestroy} from '../render3/util/view_utils';
const EXECUTE_CALLBACK_IF_ALREADY_DESTROYED = false;
/**
* `DestroyRef` lets you set callbacks to run for any cleanup or destruction behavior.
* The scope of this destruction depends on where `DestroyRef` is injected. If `DestroyRef`
@ -84,12 +82,6 @@ export class NodeInjectorDestroyRef extends DestroyRef {
override onDestroy(callback: () => void): () => void {
const lView = this._lView;
// TODO(atscott): Remove once g3 cleanup is complete
if (EXECUTE_CALLBACK_IF_ALREADY_DESTROYED && isDestroyed(lView)) {
callback();
return () => {};
}
storeLViewOnDestroy(lView, callback);
return () => removeLViewOnDestroy(lView, callback);
}