Browse Source

UI: Fixed detect change state in dashboard

pull/12551/head
Vladyslav_Prykhodko 2 years ago
parent
commit
be41d477f8
  1. 14
      ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts

14
ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts

@ -25,6 +25,7 @@ import { WidgetContext } from '@home/models/widget-component.models';
import {
BehaviorSubject,
forkJoin,
merge,
Observable,
Observer,
of,
@ -33,7 +34,7 @@ import {
switchMap,
throwError
} from 'rxjs';
import { catchError, delay, map, share, take } from 'rxjs/operators';
import { catchError, debounceTime, delay, map, share, take } from 'rxjs/operators';
import { AfterViewInit, ChangeDetectorRef, Directive, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core';
import {
DataToValueSettings,
@ -657,8 +658,15 @@ export class DashboardStateWithParamsGetter<V> extends ValueGetter<V> {
if (this.simulated) {
return of({id: 'default', params: {}});
} else {
return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe(
map(id => ({id, params: deepClone(this.ctx.stateController.getStateParams())}))
return merge(
this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId,
this.ctx.stateController.dashboardCtrl.dashboardCtx.stateChanged
).pipe(
debounceTime(10),
map(() => ({
id: this.ctx.stateController.getStateId(),
params: deepClone(this.ctx.stateController.getStateParams())
}))
);
}
}

Loading…
Cancel
Save