scttcper / ngx-toastr

🍞 Angular Toastr
https://ngx-toastr.vercel.app
MIT License
2.51k stars 359 forks source link

Triggering a toast creates loop #1019

Open sorcamarian opened 3 months ago

sorcamarian commented 3 months ago

I have a click event watching and when triggered it shows a success toast. It has a global timeout of 5000ms. During this millisecond the elements keep re-rendering and prevents event execution

sorcamarian commented 3 months ago

Is there a way to run toaster outside of Zone?

I tried

 this._ngZone.runOutsideAngular(() => {
     this.toastr.success('Toastr fun!');
 });

And it still creates a loop

sorcamarian commented 3 months ago

I noticed that this happens only when the progress bar is enabled.

    ToastrModule.forRoot({
      timeOut: 5000,
      positionClass: 'toast-top-right',
      preventDuplicates: false,
      progressBar : true,
      closeButton : true
    })
sorcamarian commented 3 months ago

https://stackoverflow.com/questions/78595897/angular-ngx-toastr-progress-bar-causes-infinite-loop