Commit bdd4c30fc0ac34d606f434c46dedf76354b8b4b7

Authored by Vladyslav_Prykhodko
1 parent 0a53e2ff

Fixed clear state params for change dashboardId

@@ -100,7 +100,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon @@ -100,7 +100,7 @@ export abstract class StateControllerComponent implements IStateControllerCompon
100 this.rxSubscriptions.push(this.route.queryParamMap.subscribe((paramMap) => { 100 this.rxSubscriptions.push(this.route.queryParamMap.subscribe((paramMap) => {
101 const dashboardId = this.route.snapshot.params.dashboardId; 101 const dashboardId = this.route.snapshot.params.dashboardId;
102 if (this.dashboardId === dashboardId) { 102 if (this.dashboardId === dashboardId) {
103 - const newState = decodeURIComponent(paramMap.get('state')); 103 + const newState = this.decodeStateParam(paramMap.get('state'));
104 if (this.currentState !== newState) { 104 if (this.currentState !== newState) {
105 this.currentState = newState; 105 this.currentState = newState;
106 if (this.inited) { 106 if (this.inited) {
@@ -147,10 +147,15 @@ export abstract class StateControllerComponent implements IStateControllerCompon @@ -147,10 +147,15 @@ export abstract class StateControllerComponent implements IStateControllerCompon
147 } 147 }
148 148
149 public reInit() { 149 public reInit() {
150 - this.currentState = decodeURIComponent(this.route.snapshot.queryParamMap.get('state')); 150 + this.preservedState = null;
  151 + this.currentState = this.decodeStateParam(this.route.snapshot.queryParamMap.get('state'));
151 this.init(); 152 this.init();
152 } 153 }
153 154
  155 + private decodeStateParam(stateURI: string): string{
  156 + return stateURI !== null ? decodeURIComponent(stateURI) : null;
  157 + }
  158 +
154 protected abstract init(); 159 protected abstract init();
155 160
156 protected abstract onMobileChanged(); 161 protected abstract onMobileChanged();