Skip to content

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

Fix missing availableHeight on model native editor (#69723)

Romeo Van Snickf3f72f8cb3c1
diff --git a/e2e/test/scenarios/models/reproductions.cy.spec.ts b/e2e/test/scenarios/models/reproductions.cy.spec.ts
index ad5d64ecbee..72df7b4ca55 100644
--- a/e2e/test/scenarios/models/reproductions.cy.spec.ts
+++ b/e2e/test/scenarios/models/reproductions.cy.spec.ts
@@ -2100,3 +2100,20 @@ describe("issue 67680", () => {
});
});
});
+
+describe("issue 69722", () => {
+ beforeEach(() => {
+ H.restore();
+ cy.signInAsNormalUser();
+ cy.visit("/model/new");
+ cy.findByRole("link", { name: /native query/ }).click();
+ });
+
+ it("should not be possible to overflow the native query editor (metabase#69722)", () => {
+ H.NativeEditor.type("{enter}".repeat(20));
+
+ cy.findByTestId("native-query-editor-container")
+ .findByTestId("run-button")
+ .should("be.visible");
+ });
+});
diff --git a/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetEditorInner.tsx b/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetEditorInner.tsx
index 7520cffc2a0..d7ead41afe4 100644
--- a/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetEditorInner.tsx
+++ b/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetEditorInner.tsx
@@ -732,7 +732,7 @@ const DatasetEditorInnerView = (props: DatasetEditorInnerProps) => {
{...props}
isActive={isEditingQuery}
height={editorHeight}
- viewHeight={height}
+ availableHeight={height}
onResizeStop={handleResize}
/>
)}
diff --git a/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetQueryEditor.jsx b/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetQueryEditor.jsx
index f4b879df7b0..f4661a68347 100644
--- a/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetQueryEditor.jsx
+++ b/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetQueryEditor.jsx
@@ -25,6 +25,7 @@ const SMOOTH_RESIZE_STYLE = { transition: "height 0.25s" };
const propTypes = {
question: PropTypes.object.isRequired,
isActive: PropTypes.bool.isRequired, // if QB mode is set to "query"
+ availableHeight: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
onSetDatabaseId: PropTypes.func,
};