From 9a1d8c27a2ce755dcf07de9ffc89cd7e4627e936 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 19:40:15 +0300 Subject: [PATCH] [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 6524febbd4486f8daae8dc32bb1ff67cd117c6eb) Co-authored-by: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com> --- 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();