Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix(SDK, Embed JS): Hide Static Question topbar from DOM when no children rendered (#67852)

Timofey Kachalovd5b070b8a349
diff --git a/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx b/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx
index 00d316e2cee..f0b0ab7c5bf 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx
@@ -120,6 +120,9 @@ const StaticQuestionInner = (
);
};
+ const hasResultToolbar = withChartTypeSelector || withDownloads;
+ const hasTopBar = Boolean(title || hasResultToolbar || isGuestEmbed);
+
return (
<SdkQuestion
questionId={questionId ?? null}
@@ -143,18 +146,20 @@ const StaticQuestionInner = (
h="100%"
gap="xs"
>
- <Stack className={InteractiveQuestionS.TopBar} gap="sm" p="md">
- {title && <DefaultViewTitle title={title} />}
+ {hasTopBar && (
+ <Stack className={InteractiveQuestionS.TopBar} gap="sm" p="md">
+ {title && <DefaultViewTitle title={title} />}
- {(withChartTypeSelector || withDownloads) && (
- <ResultToolbar>
- {withChartTypeSelector && <SdkQuestion.ChartTypeDropdown />}
- {withDownloads && <SdkQuestion.DownloadWidgetDropdown />}
- </ResultToolbar>
- )}
+ {hasResultToolbar && (
+ <ResultToolbar>
+ {withChartTypeSelector && <SdkQuestion.ChartTypeDropdown />}
+ {withDownloads && <SdkQuestion.DownloadWidgetDropdown />}
+ </ResultToolbar>
+ )}
- {isGuestEmbed && <SdkQuestion.SqlParametersList />}
- </Stack>
+ {isGuestEmbed && <SdkQuestion.SqlParametersList />}
+ </Stack>
+ )}
<Box className={InteractiveQuestionS.Main} w="100%" h="100%">
<Box className={InteractiveQuestionS.Content}>