Skip to content

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

Migrate query action editor (#75015)

Romeo Van Snick84e629c4613b
diff --git a/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/QueryActionEditor.tsx b/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/QueryActionEditor.tsx
index 22b1b0b30b8..3c531377ed4 100644
--- a/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/QueryActionEditor.tsx
+++ b/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/QueryActionEditor.tsx
@@ -18,13 +18,13 @@ function QueryActionEditor({
query={query}
question={question}
setDatasetQuery={onChangeQuestionQuery}
- hasEditingSidebar={false}
isNativeEditorOpen
- hasParametersList={false}
resizable={false}
readOnly={!isEditable}
editorContext="action"
- />
+ >
+ <NativeQueryEditor.TopBar />
+ </NativeQueryEditor>
);
}
diff --git a/frontend/src/metabase/query_builder/components/NativeQueryEditor/NativeQueryEditorRoot.tsx b/frontend/src/metabase/query_builder/components/NativeQueryEditor/NativeQueryEditorRoot.tsx
index 23fd9fa658a..a48898fd6e4 100644
--- a/frontend/src/metabase/query_builder/components/NativeQueryEditor/NativeQueryEditorRoot.tsx
+++ b/frontend/src/metabase/query_builder/components/NativeQueryEditor/NativeQueryEditorRoot.tsx
@@ -323,7 +323,7 @@ export const NativeQueryEditorRoot = forwardRef<
// button, extra buttons, custom content rendered over the editor surface).
let topBar: ReactNode = null;
const bodySlots: ReactNode[] = [];
- Children.forEach(children, (child) => {
+ Children.toArray(children).forEach((child) => {
if (isValidElement(child) && child.type === TopBar) {
topBar = cloneElement(child, { ref: topBarRef });
} else {
diff --git a/frontend/src/metabase/query_builder/components/NativeQueryEditor/slots/TopBar.tsx b/frontend/src/metabase/query_builder/components/NativeQueryEditor/slots/TopBar.tsx
index 4b7533b9fd6..7eca6427d96 100644
--- a/frontend/src/metabase/query_builder/components/NativeQueryEditor/slots/TopBar.tsx
+++ b/frontend/src/metabase/query_builder/components/NativeQueryEditor/slots/TopBar.tsx
@@ -57,7 +57,7 @@ export const TopBar = forwardRef<HTMLDivElement, PropsWithChildren>(
const leftActions: ReactNode[] = [];
const rightActions: ReactNode[] = [];
- Children.forEach(children, (child) => {
+ Children.toArray(children).forEach((child) => {
if (isValidElement(child) && child.type === ParametersList) {
leftActions.push(child);
} else {