ngrx/store

Observables Async Piped no longer cycle once in Chrome without Redux web tools!?

alastair-todd opened this issue · 1 comments

Hello

Can someone tell me what triggers a change detection for an async pipe?

I have some plain old state switches like "is this button toggled on" and a number of components subscribing. Now in UAT I have loads of bug reports that are not happening during development.

Out of fluke, I found out that when the Redux dev tools are either not installed or disabled, these errors appear, and is always around an Async Pipe in my templates.

Am reverting to change detection, but this seems like an anti-pattern. Has anyone an explanation? Here's some typical code that no longer changes detects on its own.


this.projectIsOpen$ = this.store.select(fromRoot.isProjectOpen);

...

<div *ng-if="projectIsOpen$ | async"

having to revert to this (and across my codebase = will steal days):

this.store.select(fromRoot.isProjectOpen).subscribe(open => {
            this.zone.run(() => {
                this.isProjectOpen = open;
            });
        });

...

<div *ng-if="projectIsOpen"

Going to close this. The answer is in the problem - I have some legacy code calling angular components directly from window. That code needs wrapping in a zone.run in order to be seviced by ng cycling.

setCursor(cursorClassName: string) {
     this.zone.run(() => {
         this.store.dispatch(new mapToolbarActions.ChangeCursor(cursorClassName));
     });
 }