refactor(core): make AfterRenderImpl tree-shakable by moving PHASES (#58297)

Marked the PHASES constant within AfterRenderImpl as @__PURE__ to enable better tree-shaking during bundling. This optimization ensures that unused code is more effectively eliminated, improving overall bundle size and performance.

Closes #58296

PR Close #58297
This commit is contained in:
Alan Agius 2024-10-22 08:52:33 +00:00 committed by Alex Rickabaugh
parent 7dfb127c03
commit cf7f8c7c03

View file

@ -33,12 +33,13 @@ export class AfterRenderManager {
}
export class AfterRenderImpl {
static readonly PHASES = [
AfterRenderPhase.EarlyRead,
AfterRenderPhase.Write,
AfterRenderPhase.MixedReadWrite,
AfterRenderPhase.Read,
] as const;
static readonly PHASES = /* @__PURE__ **/ (() =>
[
AfterRenderPhase.EarlyRead,
AfterRenderPhase.Write,
AfterRenderPhase.MixedReadWrite,
AfterRenderPhase.Read,
] as const)();
private readonly ngZone = inject(NgZone);
private readonly scheduler = inject(ChangeDetectionScheduler);