You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2026/09/04 06:19:46 UTC
(superset) branch sqllab-run-dropdown-color-crash created (now ce986b70794)
This is an automated email from the ASF dual-hosted git repository.
sadpandajoe pushed a change to branch sqllab-run-dropdown-color-crash
in repository https://gitbox.apache.org/repos/asf/superset.git
at ce986b70794 fix(sqllab): fix crash and wrong caret color on SQL Lab Run dropdown
This branch includes the following new commits:
new ce986b70794 fix(sqllab): fix crash and wrong caret color on SQL Lab Run dropdown
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: fix(sqllab): fix crash and wrong caret color on SQL Lab Run dropdown
Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sadpandajoe pushed a commit to branch sqllab-run-dropdown-color-crash
in repository https://gitbox.apache.org/repos/asf/superset.git
commit ce986b707941a61807c3fa12fe7fe528d27ba466
Author: sadpandajoe <jc...@gmail.com>
AuthorDate: Fri Sep 4 06:19:28 2026 +0000
fix(sqllab): fix crash and wrong caret color on SQL Lab Run dropdown
When CTAS/CVAS is allowed on a database, the Run button renders as a
split button via DropdownButton, passing menu content through the
deprecated antd `overlay` prop. antd v6 dropped `overlay` support
entirely, so the passthrough silently became a no-op and clicking the
dropdown caret threw "React.Children.only expected to receive a single
React element child." Pass the menu through `popupRender`, the prop
DropdownButton actually wires up.
Also fixes the caret icon color: it used `colorIcon`, a neutral token
meant for icons on default surfaces, which renders as dark grey against
the primary/danger button background. Use `colorTextLightSolid` instead,
matching the icon-on-primary-button pattern used elsewhere in the
codebase.
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
.../DropdownButton/DropdownButton.test.tsx | 14 +++++++++++++
.../RunQueryActionButton.test.tsx | 24 ++++++++++++++++++++++
.../components/RunQueryActionButton/index.tsx | 6 ++++--
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/packages/superset-ui-core/src/components/DropdownButton/DropdownButton.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/DropdownButton/DropdownButton.test.tsx
index e0d3719b803..a4ea9fe9f8c 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/DropdownButton/DropdownButton.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/DropdownButton/DropdownButton.test.tsx
@@ -74,3 +74,17 @@ test('passes button type to underlying Dropdown.Button', () => {
);
expect(container.querySelector('.ant-btn-primary')).toBeInTheDocument();
});
+
+test('opens the popupRender content without crashing on click trigger', async () => {
+ const { getAllByRole, findByText } = render(
+ <DropdownButton
+ popupRender={() => <div>Custom Menu</div>}
+ trigger={['click']}
+ >
+ Click
+ </DropdownButton>,
+ );
+ const buttons = getAllByRole('button');
+ fireEvent.click(buttons[buttons.length - 1]);
+ expect(await findByText('Custom Menu')).toBeInTheDocument();
+});
diff --git a/superset-frontend/src/SqlLab/components/RunQueryActionButton/RunQueryActionButton.test.tsx b/superset-frontend/src/SqlLab/components/RunQueryActionButton/RunQueryActionButton.test.tsx
index 61b56137929..a89324e8952 100644
--- a/superset-frontend/src/SqlLab/components/RunQueryActionButton/RunQueryActionButton.test.tsx
+++ b/superset-frontend/src/SqlLab/components/RunQueryActionButton/RunQueryActionButton.test.tsx
@@ -19,6 +19,8 @@
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { Store } from 'redux';
+import { supersetTheme } from '@apache-superset/core/theme';
+import { Menu } from '@superset-ui/core/components/Menu';
import { render, fireEvent, waitFor } from 'spec/helpers/testing-library';
import { initialState, defaultQueryEditor } from 'src/SqlLab/fixtures';
@@ -153,3 +155,25 @@ test('dispatch stopQuery on click while running state', async () => {
fireEvent.click(button);
await waitFor(() => expect(stopQuery).toHaveBeenCalledTimes(1));
});
+
+const ctasMenu = <Menu items={[{ key: 'table', label: 'CREATE TABLE AS' }]} />;
+
+test('opening the CTAS/CVAS dropdown menu does not crash and shows the menu', async () => {
+ const { getAllByRole, findByText } = setup(
+ { overlayCreateAsMenu: ctasMenu },
+ mockStore(initialState),
+ );
+ const buttons = getAllByRole('button');
+ const caretButton = buttons[buttons.length - 1];
+ fireEvent.click(caretButton);
+ expect(await findByText('CREATE TABLE AS')).toBeInTheDocument();
+});
+
+test('renders the caret icon with a color that contrasts with the primary button background', () => {
+ const { container } = setup(
+ { overlayCreateAsMenu: ctasMenu },
+ mockStore(initialState),
+ );
+ const caretIcon = container.querySelector('[data-test="down"]');
+ expect(caretIcon).toHaveStyle({ color: supersetTheme.colorTextLightSolid });
+});
diff --git a/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx b/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
index 9999c884487..3c8f7d87db4 100644
--- a/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
+++ b/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
@@ -149,11 +149,13 @@ const RunQueryActionButton = ({
cta
{...(overlayCreateAsMenu
? {
- overlay: overlayCreateAsMenu,
+ popupRender: () => overlayCreateAsMenu,
icon: (
<Icons.DownOutlined
iconColor={
- isDisabled ? theme.colorTextDisabled : theme.colorIcon
+ isDisabled
+ ? theme.colorTextDisabled
+ : theme.colorTextLightSolid
}
/>
),