The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix collapsed visualization in the dashboard new-question query builder (#81163)
Sébastiened6247eb24f1
diff --git a/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsxindex 034e4860291..ea3d544d0ad 100644--- a/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx+++ b/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx@@ -303,6 +303,12 @@ describe("scenarios > embedding-sdk > editable-dashboard", () => {H.popover().findByRole("link", { name: "Orders" }).click();cy.button("Visualize").click();+ cy.log("the preview renders instead of collapsing (metabase#79893)");+ cy.findByTestId("visualization-root")+ .should("be.visible")+ .invoke("outerHeight")+ .should("be.greaterThan", 0);+cy.log("test going back to the dashboard from the visualization");cy.button(`Back to ${DASHBOARD_NAME}`).should("be.visible").click();diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsxindex 9f753e1cb9a..8b916f247aa 100644--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx@@ -89,17 +89,23 @@ const MaybeStyledWrapper = ({skip,className,style,+ fullHeight,children,}: {skip: boolean;className?: string;style?: React.CSSProperties;+ fullHeight?: boolean;children: React.ReactNode;}) =>skip ? (<>{children}</>) : (- <SdkDashboardStyledWrapper className={className} style={style}>+ <SdkDashboardStyledWrapper+ className={className}+ style={style}+ fullHeight={fullHeight}+ >{children}</SdkDashboardStyledWrapper>);@@ -652,6 +658,7 @@ const SdkDashboardInner = ({skip={skipStyledWrapper}className={className}style={style}+ fullHeight><DashboardQueryBuilderonCreate={(question) => {diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.css b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.cssindex 1d0dfff9e6c..1808d475aa7 100644--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.css+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.css@@ -3,3 +3,14 @@background-color: var(--mb-color-bg-dashboard);scrollbar-gutter: stable;}++/* The query builder sizes itself with percentage heights, which need a parent+ with a definite height. A `min-height`-only flex column gives them none, so+ the visualization collapses to 0 (EMB-2252). A grid row does resolve against+ `min-height`: this fills a host that sets a height, and falls back to 700px+ when the host is auto-height. */+.FullHeight {+ display: grid;+ grid-template: 1fr / 1fr;+ min-height: max(100%, 700px);+}diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsxindex 92e33ac4b4c..bdf120b9eee 100644--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx@@ -10,8 +10,17 @@ import SdkDashboardStyleWrapperS from "./SdkDashboardStyleWrapper.module.css";export const SdkDashboardStyledWrapper = ({className,style,+ fullHeight = false,children,-}: PropsWithChildren<CommonStylingProps>) => {+}: PropsWithChildren<+ CommonStylingProps & {+ /**+ * Stretches the child to the wrapper's height, so children sized with+ * percentage heights have something to resolve against.+ */+ fullHeight?: boolean;+ }+>) => {return (<Flexdirection="column"@@ -20,6 +29,7 @@ export const SdkDashboardStyledWrapper = ({className={cx(className,SdkDashboardStyleWrapperS.SdkDashboardStyleWrapper,+ fullHeight && SdkDashboardStyleWrapperS.FullHeight,CS.overflowAuto,)}style={style}