NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.87k stars 3.94k forks source link

Change detection in drawer stops to work when returning from modal #8630

Open lasas opened 4 months ago

lasas commented 4 months ago

Reproduction link

https://stackblitz.com/edit/stackblitz-starters-r33rar?file=src%2Fmain.ts

Steps to reproduce

  1. Open drawer
  2. Open modal (button in drawer will be in loading state)
  3. Close modal

What is expected?

After closing modal, button in drawer should be in normal state (not loading).

What is actually happening?

After closing modal, button in drawer is still in loading state.

Environment Info
ng-zorro-antd 18.0.1
Browser Firefox, Google Chrome

It's regression after upgrade to v18. Not sure if it's CDK or ng-zorro-antd.

It's possible to workaround it using ChangeDetectorRef.markForCheck()

lasas commented 2 months ago

My guess, that this is result of Angular changes in v18: https://github.com/angular/angular/commit/64f870c12bae1ad66509f0d65f8d3e051aae6eaa

But I'm still not sure, that's the best way to solve it. It's possible to use markForCheck() after closing modal (like commented line in sample). But maybe the better way to migrate to signals? Locally, I converted modalOpened to signal and no more issue. Is the signals are the way to go?