[v11.0.x] datatrails: reloaded trail bugs related to no selected metric (#87346)
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).
(cherry picked from commit e9b932c8f6)
Co-authored-by: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com>
This commit is contained in:
co-authored by
Darren Janeczek
parent
5bbe953b0f
commit
4748dc67a2
@@ -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