From 6524febbd4486f8daae8dc32bb1ff67cd117c6eb Mon Sep 17 00:00:00 2001 From: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com> Date: Fri, 3 May 2024 12:22:23 -0400 Subject: [PATCH] datatrails: quick bugfix: handle undefined step (#87337) fix: handle undefined step --- public/app/features/trails/DataTrail.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/app/features/trails/DataTrail.tsx b/public/app/features/trails/DataTrail.tsx index 840a89878ab..e3150253c69 100644 --- a/public/app/features/trails/DataTrail.tsx +++ b/public/app/features/trails/DataTrail.tsx @@ -94,8 +94,10 @@ export class DataTrail extends SceneObjectBase { } // 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();