-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Detection fired if Redux Devtools listens a store.dispatch()
#476
Comments
I have a same problem( @NgModule({
declarations: [
...,
PageComponent,
],
imports: [
// Modules
...,
PageModule,
...,
// Router
RouterModule.forRoot(routeConfig),
BrowserModule,
// Store
StoreModule.forRoot(reducers, {metaReducers}),
EffectsModule.forRoot([..., PageEffects, ...]),
// StoreDevtoolsModule.instrument(),
HttpClientModule,
],
providers: [{
provide: HTTP_INTERCEPTORS,
useClass: UnAuthorisedHttpInterceptor,
multi: true,
}],
bootstrap: [AppComponent],
})
export class AppModule {
} If StoreDevtoolsModule.instrument() is disabled and Redux Dev Tools in browser is disabled, changes in store not detect after first loading page (F5). <div class="info">
<div class="title">{{(current | async)?.title}}</div>
<div class="group">{{(current | async)?.title}}</div>
</div> current - not update after changes. If I add to Component constructor(public store: Store<any>, private changeDetector: ChangeDetectorRef) {
} and _dataInitializer() {
// Subscribe on player
this.storeData.subscribe(data => {
if (data.current !== null) {
if (!this.isCurrentInitOnLoadPage) {
this.isCurrentInitOnLoadPage = true;
this.createObject(data.current);
this.isSetFirstChange = true;
} else {
this.dataEventEmitter.emit({type: `start:1`, id: 1});
this.isSetFirstChange = false;
}
// For first initialize
if (this.isSetFirstChange) {
this.changeDetector.detectChanges();
}
}
});
} detect changes is worked. Current is updated. |
We had exactly the same issue, the problem was in our code. There is a callback, which is coming from a 3rd party library. In this callback we call the "store.dispatch" function. No change detection happens. (without the redux plugin). We fixed our code to make sure the "store.dispatch" in called within the ngZone:
This example explains it good:
|
hi, this thing also happened to me, with a 3rd party javascript library. |
Simple Reproduction. Try it with and without Redux Dev Tools and watch the counter and the console. Tested with Chrome 71.0.3578.98 and Redux DevTools 2.17.0 |
This caused some false-positives in our application recently, where we had forgotten to call |
I'm submitting a...
What is the current behavior?
If you call
store.dispatch
outside of an Angular Zone, but have the Redux Devtools extension active and the store-devtools configured, Angular will run a Change Detection cycle.I'm not too sure of who should I ask about this, since its a Redux extension event listener distracting Angular to do CD. But I'll start here :)
Expected behavior:
To not run a Change Detection cycle, as when store-devtools (or Redux Devtools) is not configured.
Version of affected browser(s),operating system(s), npm, node and ngrx:
Basically decent latests: Linux x64 (Ubuntu), npm 5.3.0, node 8.6.0, @ngrx/store 4.0.3, @ngrx/store/devtools 4.0.0.
The text was updated successfully, but these errors were encountered: