From 40ee105b1d3223e304d07b7ad7c42c239cb243f6 Mon Sep 17 00:00:00 2001 From: Devon Thomson Date: Thu, 1 Apr 2021 13:15:28 -0400 Subject: [PATCH] Fixed iframe filtering by not re-creating embed settings on URL change (#95997) (#96057) --- .../dashboard/public/application/dashboard_router.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/dashboard/public/application/dashboard_router.tsx b/src/plugins/dashboard/public/application/dashboard_router.tsx index f981b135c4359b..e5281a257ee13d 100644 --- a/src/plugins/dashboard/public/application/dashboard_router.tsx +++ b/src/plugins/dashboard/public/application/dashboard_router.tsx @@ -84,6 +84,7 @@ export async function mountApp({ const spacesApi = pluginsStart.spacesOss?.isSpacesAvailable ? pluginsStart.spacesOss : undefined; const activeSpaceId = spacesApi && (await spacesApi.activeSpace$.pipe(first()).toPromise())?.id; + let globalEmbedSettings: DashboardEmbedSettings | undefined; const dashboardServices: DashboardAppServices = { navigation, @@ -149,9 +150,6 @@ export async function mountApp({ const getDashboardEmbedSettings = ( routeParams: ParsedQuery ): DashboardEmbedSettings | undefined => { - if (!routeParams.embed) { - return undefined; - } return { forceShowTopNavMenu: Boolean(routeParams[dashboardUrlParams.showTopMenu]), forceShowQueryInput: Boolean(routeParams[dashboardUrlParams.showQueryInput]), @@ -162,11 +160,13 @@ export async function mountApp({ const renderDashboard = (routeProps: RouteComponentProps<{ id?: string }>) => { const routeParams = parse(routeProps.history.location.search); - const embedSettings = getDashboardEmbedSettings(routeParams); + if (routeParams.embed && !globalEmbedSettings) { + globalEmbedSettings = getDashboardEmbedSettings(routeParams); + } return ( redirect(routeProps, props)} />