Skip to content

fix(compiler): default to Eager change detection for pre-v22 libraries in JIT - #71118

Open
JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:fix-jit-onpush-default
Open

JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:fix-jit-onpush-default

Conversation

@JeanMeche

Copy link
Copy Markdown
Member

The convertDeclareComponentFacadeToMetadata function in the JIT compiler facade previously defaulted component change detection to OnPush. This caused components compiled with older versions of Angular (< 22) in partial compilation mode to incorrectly use OnPush in JIT (e.g., in Storybook or Jest), despite working properly with Default in the AOT linker.

Update the JIT facade to match the AOT linker behavior by checking the major version of the declaration. It defaults to OnPush only for components compiled with v22+ or the placeholder version, and uses Default change detection for older libraries.

Fixes #71107

@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Oct 1, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 1, 2026
@JeanMeche
JeanMeche requested a review from crisbeto October 1, 2026 13:39
…s in JIT

The `convertDeclareComponentFacadeToMetadata` function in the JIT compiler facade previously defaulted component change detection to `OnPush`. This caused components compiled with older versions of Angular (< 22) in partial compilation mode to incorrectly use `OnPush` in JIT (e.g., in Storybook or Jest), despite working properly with `Default` in the AOT linker.
Update the JIT facade to match the AOT linker behavior by checking the major version of the declaration. It defaults to `OnPush` only for components compiled with v22+ or the placeholder version, and uses `Default` change detection for older libraries.

Fixes angular#71107
@JeanMeche
JeanMeche force-pushed the fix-jit-onpush-default branch from f06d6f1 to cb5a954 Compare October 1, 2026 14:07
Comment thread packages/compiler/src/util.ts Outdated
Comment thread packages/compiler/src/util.ts Outdated
This addresses a PR review comment by removing redundant checks that would otherwise fall through to returning true anyway.
@JeanMeche
JeanMeche force-pushed the fix-jit-onpush-default branch from e8fb22c to 550da5c Compare October 1, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

2 participants