DEV Community

Cover image for After the Angular 22 upgrade, grep for this first
Mohammad Khalifeh
Mohammad Khalifeh

Posted on

After the Angular 22 upgrade, grep for this first

The build is green, the tests pass, and a list still doesn't refresh after saving. The usual cause: a plain class field changed inside subscribe().

With OnPush as the default and zoneless change detection, Angular only re-renders when it is told something changed. A signal tells it. A bare this.items.push(saved) doesn't, so the data is right and the screen is stale.

Fix: keep the state in a signal and use items.update(list => [...list, saved]).

The other places this hides (reactive forms, third-party callbacks, NgZone.onStable) are in the longer write-up: https://mkcodestudio.com/en/insights/angular-22-screen-not-updating-onpush-zoneless?utm_source=devto&utm_medium=quickpost

Top comments (0)