Skip to content

fix(angular): restore change detection for routed pages - #31414

Open
ShaneK wants to merge 5 commits into
mainfrom
FW-7725
Open

fix(angular): restore change detection for routed pages#31414
ShaneK wants to merge 5 commits into
mainfrom
FW-7725

Conversation

@ShaneK

@ShaneK ShaneK commented Aug 31, 2026

Copy link
Copy Markdown
Member

Issue number: resolves #31406


What is the current behavior?

The ion-router-outlet and ion-tabs components didn't declare a changeDetection strategy, so the Angular partial linker filled one in. An Angular 22 linker fills in OnPush when our emitted declaration is stamped 22 or later, while Angular 18 through 21 linkers fill in Default. Bumping this package's own Angular version to 22 was enough to flip both components for every Angular 22 consumer.

A clean OnPush view stops a tick traversing into anything below it, so on Angular 22 with Zone.js the routed page inside the outlet never re-rendered. State set as a plain field after an await stayed stale.

What is the new behavior?

Every @Component in packages/angular/src now declares its strategy explicitly, so the linker can't pick one for us. The ion-router-outlet and ion-tabs components are Default because routed pages are created inside their own views; everything else is OnPush, including ion-nav, whose pages the delegate attaches as root views instead.

Does this introduce a breaking change?

  • Yes
  • No

Other information

This PR also adds an ng22-zone app to prevent future regressions like this one.

Current dev build:

9.0.2-dev.11788201761.1a20dc3a

@ShaneK
ShaneK requested a review from a team as a code owner August 31, 2026 16:07
@ShaneK
ShaneK requested a review from brandyscarney August 31, 2026 16:07
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Sep 1, 2026 7:26pm UTC

Request Review

@github-actions github-actions Bot added package: core @ionic/core package package: angular @ionic/angular package labels Aug 31, 2026

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good but I'm going to leave a comment on the ticket with an issue I found in the test app!

Comment on lines +9 to +10
- an `// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection` above it, with a comment saying why. That rule is an error here. It only fires on an explicit non-OnPush value, never on a missing one, so it can't enforce the rule above on its own.
- an entry in `EAGER_COMPONENTS` in `packages/angular/scripts/verify-change-detection.js`, keyed by class name and listing every dist file it is emitted into (one for lazy, one for standalone).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add example code of components / lines that need these?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread docs/angular/change-detection.md Outdated
@@ -0,0 +1,23 @@
# Change Detection

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Change Detection
# Angular Change Detection

Just to be consistent with the testing headings

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, fixed: efe166d

rules: {
'@angular-eslint/prefer-standalone': 'off',
'@angular-eslint/prefer-inject': 'off',
// Test pages declare eager change detection on purpose: they exist to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to include the issue number everywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed efe166d


@Component({
selector: 'app-root',
// A tick won't descend past a clean OnPush view, which is Angular 22's default (#31406).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to include the issue number everywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed efe166d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: UI does not update after async/await operations with Zone.js enabled in v9

2 participants