Skip to content

Commit bd36e4f

Browse files
committed
Fixed iframe filtering by not re-creating embed settings on URL change
1 parent 589f49f commit bd36e4f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plugins/dashboard/public/application/dashboard_router.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export async function mountApp({
8484

8585
const spacesApi = pluginsStart.spacesOss?.isSpacesAvailable ? pluginsStart.spacesOss : undefined;
8686
const activeSpaceId = spacesApi && (await spacesApi.activeSpace$.pipe(first()).toPromise())?.id;
87+
let globalEmbedSettings: DashboardEmbedSettings | undefined;
8788

8889
const dashboardServices: DashboardAppServices = {
8990
navigation,
@@ -149,9 +150,6 @@ export async function mountApp({
149150
const getDashboardEmbedSettings = (
150151
routeParams: ParsedQuery<string>
151152
): DashboardEmbedSettings | undefined => {
152-
if (!routeParams.embed) {
153-
return undefined;
154-
}
155153
return {
156154
forceShowTopNavMenu: Boolean(routeParams[dashboardUrlParams.showTopMenu]),
157155
forceShowQueryInput: Boolean(routeParams[dashboardUrlParams.showQueryInput]),
@@ -162,11 +160,13 @@ export async function mountApp({
162160

163161
const renderDashboard = (routeProps: RouteComponentProps<{ id?: string }>) => {
164162
const routeParams = parse(routeProps.history.location.search);
165-
const embedSettings = getDashboardEmbedSettings(routeParams);
163+
if (routeParams.embed && !globalEmbedSettings) {
164+
globalEmbedSettings = getDashboardEmbedSettings(routeParams);
165+
}
166166
return (
167167
<DashboardApp
168168
history={routeProps.history}
169-
embedSettings={embedSettings}
169+
embedSettings={globalEmbedSettings}
170170
savedDashboardId={routeProps.match.params.id}
171171
redirectTo={(props: RedirectToProps) => redirect(routeProps, props)}
172172
/>

0 commit comments

Comments
 (0)