Fixed iframe filtering by not re-creating embed settings on URL change (#95997)

This commit is contained in:
Devon Thomson 2021-04-01 11:03:27 -04:00 committed by GitHub
parent 37e2aa3b9c
commit 3b3ad0ecaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<string>
): 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 (
<DashboardApp
history={routeProps.history}
embedSettings={embedSettings}
embedSettings={globalEmbedSettings}
savedDashboardId={routeProps.match.params.id}
redirectTo={(props: RedirectToProps) => redirect(routeProps, props)}
/>