datatrails: reloaded trail bugs related to no selected metric (#87344)
* fix: reloaded scene first step topScene The top scene was not being initialized when reloading trails, causing it to use the top scene of whatever was selected previously. * fix: select new metric node not reloading right On reloading trails, any metric node that was 'green' with a undefined metric due to clicking on the "select new metric" button, was reloading with the metric of the step directly before it (in index order).
This commit is contained in:
@@ -169,6 +169,11 @@ export class DataTrail extends SceneObjectBase<DataTrailState> {
|
||||
public restoreFromHistoryStep(state: DataTrailState) {
|
||||
this.disableUrlSync();
|
||||
|
||||
if (!state.topScene && !state.metric) {
|
||||
// If the top scene for an is missing, correct it.
|
||||
state.topScene = new MetricSelectScene({});
|
||||
}
|
||||
|
||||
this.setState(
|
||||
sceneUtils.cloneSceneObjectState(state, {
|
||||
history: this.state.history,
|
||||
@@ -213,7 +218,7 @@ export class DataTrail extends SceneObjectBase<DataTrailState> {
|
||||
if (this.state.metric !== values.metric) {
|
||||
Object.assign(stateUpdate, this.getSceneUpdatesForNewMetricValue(values.metric));
|
||||
}
|
||||
} else if (values.metric === null) {
|
||||
} else if (values.metric == null) {
|
||||
stateUpdate.metric = undefined;
|
||||
stateUpdate.topScene = new MetricSelectScene({});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user