Improve parent state change handling by dashboard state component

This commit is contained in:
Igor Kulikov 2021-12-23 19:26:58 +02:00
parent 3ae20647aa
commit 40c2d71488

View File

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
@ -56,7 +56,8 @@ export class DashboardStateComponent extends PageComponent implements OnInit, On
private stateSubscription: Subscription;
constructor(protected store: Store<AppState>) {
constructor(protected store: Store<AppState>,
private cd: ChangeDetectorRef) {
super(store);
}
@ -68,6 +69,7 @@ export class DashboardStateComponent extends PageComponent implements OnInit, On
if (this.syncParentStateParams) {
this.stateSubscription = this.ctx.stateController.stateChanged().subscribe(() => {
this.updateCurrentState();
this.cd.markForCheck();
});
}
}