From d40a837d5c7d65c9ba5ebf781f8f0246fb1acca0 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:08:40 +0200 Subject: [PATCH] [v9.5.x] Dashboards: Prevent template variables from resolving twice (#66452) Dashboards: Prevent template variables from resolving twice (#66372) (cherry picked from commit 38ee910e396d6c99fa8489d666f023e9c80969ab) Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> --- .../core/components/AppChrome/AppChrome.tsx | 43 ++++++++++--------- .../components/AppChrome/AppChromeService.tsx | 1 + 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/public/app/core/components/AppChrome/AppChrome.tsx b/public/app/core/components/AppChrome/AppChrome.tsx index ef63d3f0fc6..1ae8cb176b9 100644 --- a/public/app/core/components/AppChrome/AppChrome.tsx +++ b/public/app/core/components/AppChrome/AppChrome.tsx @@ -47,31 +47,32 @@ export function AppChrome({ children }: Props) { }); // Chromeless routes are without topNav, mega menu, search & command palette - if (state.chromeless) { - return ( -
-
{children}
-
- ); - } + // We check chromeless twice here instead of having a separate path so {children} + // doesn't get re-mounted when chromeless goes from true to false. return (
-
- {!searchBarHidden && } - -
+ {!state.chromeless && ( +
+ {!searchBarHidden && } + +
+ )}
{children}
- chrome.setMegaMenu(false)} /> - + {!state.chromeless && ( + <> + chrome.setMegaMenu(false)} /> + + + )}
); } diff --git a/public/app/core/components/AppChrome/AppChromeService.tsx b/public/app/core/components/AppChrome/AppChromeService.tsx index bc919918d99..641d4d87283 100644 --- a/public/app/core/components/AppChrome/AppChromeService.tsx +++ b/public/app/core/components/AppChrome/AppChromeService.tsx @@ -73,6 +73,7 @@ export class AppChromeService { // Some updates can have new instance of sectionNav or pageNav but with same values if (newState.sectionNav !== current.sectionNav || newState.pageNav !== current.pageNav) { if ( + newState.actions === current.actions && navItemsAreTheSame(newState.sectionNav, current.sectionNav) && navItemsAreTheSame(newState.pageNav, current.pageNav) ) {