Skip to content

Commit

Permalink
Fixed iframe filtering by not re-creating embed settings on URL change (
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomThomson authored Apr 1, 2021
1 parent 7160918 commit 40ee105
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/dashboard/public/application/dashboard_router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]),
Expand All @@ -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)}
/>
Expand Down

0 comments on commit 40ee105

Please sign in to comment.