[v11.0.x] datatrails: quick bugfix: handle undefined step (#87338)

datatrails: quick bugfix: handle undefined step (#87337)

fix: handle undefined step
(cherry picked from commit 6524febbd4)

Co-authored-by: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-05-03 19:40:15 +03:00
committed by GitHub
co-authored by Darren Janeczek
parent 480ef44edf
commit 9a1d8c27a2
+4 -2
View File
@@ -94,8 +94,10 @@ export class DataTrail extends SceneObjectBase<DataTrailState> {
}
// Disconnects the current step history state from the current state, to prevent changes affecting history state
const currentState = this.state.history.state.steps[this.state.history.state.currentStep].trailState;
this.restoreFromHistoryStep(currentState);
const currentState = this.state.history.state.steps[this.state.history.state.currentStep]?.trailState;
if (currentState) {
this.restoreFromHistoryStep(currentState);
}
this.enableUrlSync();