From 9d5b13b56513af28db8fa09e9e6b16f7571c6656 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 24 Jan 2023 17:33:45 +0000 Subject: [PATCH] [v9.3.x] Explore: Be sure time range key bindings are mounted after clear (#62020) Explore: Be sure time range key bindings are mounted after clear (#61892) * Add list of bindings for updating on change * Revert "Add list of bindings for updating on change" This reverts commit 092707371d0c387c3ee9522b77bef3a72c62797f. * Clear keybindings before component render (cherry picked from commit 6ab79c4fba115f24ac0fd398c2909e15a4367d33) Co-authored-by: Kristina --- public/app/core/navigation/GrafanaRoute.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/app/core/navigation/GrafanaRoute.tsx b/public/app/core/navigation/GrafanaRoute.tsx index 9cfa4f6e224..1bfe2765013 100644 --- a/public/app/core/navigation/GrafanaRoute.tsx +++ b/public/app/core/navigation/GrafanaRoute.tsx @@ -1,4 +1,4 @@ -import React, { Suspense, useEffect } from 'react'; +import React, { Suspense, useEffect, useLayoutEffect } from 'react'; // @ts-ignore import Drop from 'tether-drop'; @@ -18,9 +18,11 @@ export function GrafanaRoute(props: Props) { chrome.setMatchedRoute(props.route); - useEffect(() => { + useLayoutEffect(() => { keybindings.clearAndInitGlobalBindings(); + }, [keybindings]); + useEffect(() => { updateBodyClassNames(props.route); cleanupDOM(); navigationLogger('GrafanaRoute', false, 'Mounted', props.match);