[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>
pull/87345/head
grafana-delivery-bot[bot] 1 year ago committed by GitHub
parent 480ef44edf
commit 9a1d8c27a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      public/app/features/trails/DataTrail.tsx

@ -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();

Loading…
Cancel
Save