How would you answer an interview scenario involving change detection and OnPush in Angular?
For an interview scenario involving change detection and OnPush, I would first clarify the business goal, scale, constraints, and the failure or quality attribute the interviewer wants to explore. Angular change detection updates template bindings when application state changes. OnPush reduces checks by relying on input reference changes and other explicit reactive triggers. In this scenario, if an OnPush table row does not refresh after editing a customer object, replace the object or collection immutably instead of mutating the existing reference. For production, prefer immutable updates, signals or observable streams, trackBy or track expressions for collections, and measure before adding manual change detector calls. I would then explain the main alternatives and tradeoffs, identify likely failure modes, and describe how I would validate the solution through testing, observability, security controls, and recovery or rollback planning.