You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2025/11/05 19:38:49 UTC
(superset) branch master updated: fix(DatabaseModal): prevent errors when pasting text into supported database select (#35916)
This is an automated email from the ASF dual-hosted git repository.
enzomartellucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 1f960d5761 fix(DatabaseModal): prevent errors when pasting text into supported database select (#35916)
1f960d5761 is described below
commit 1f960d5761f31d3cac2697a988b64ba08b2d980b
Author: Enzo Martellucci <52...@users.noreply.github.com>
AuthorDate: Wed Nov 5 20:38:41 2025 +0100
fix(DatabaseModal): prevent errors when pasting text into supported database select (#35916)
---
.../databases/DatabaseModal/index.test.tsx | 22 ++++++++++++++++++++++
.../src/features/databases/DatabaseModal/index.tsx | 1 +
2 files changed, 23 insertions(+)
diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
index 8b3dcc2226..bbdb9023b3 100644
--- a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
+++ b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
@@ -26,6 +26,7 @@ import {
userEvent,
within,
waitFor,
+ fireEvent,
} from 'spec/helpers/testing-library';
import { getExtensionsRegistry } from '@superset-ui/core';
import setupCodeOverrides from 'src/setup/setupCodeOverrides';
@@ -423,6 +424,27 @@ describe('DatabaseModal', () => {
expect(footer).toBeEmptyDOMElement();
});
+ test('shows database options when pasting text in the select', async () => {
+ setup();
+
+ const modal = await screen.findByRole('dialog');
+ expect(modal).toBeInTheDocument();
+
+ // Find the select input (not opening the dropdown)
+ const selectInput = screen.getByRole('combobox');
+ expect(selectInput).toBeInTheDocument();
+
+ // Simulate focusing the input
+ userEvent.click(selectInput);
+
+ // Simulate pasting text into the input
+ expect(() =>
+ fireEvent.paste(selectInput, {
+ clipboardData: { getData: () => 'post' },
+ }),
+ ).not.toThrow();
+ });
+
test('renders the "Basic" tab of SQL Alchemy form (step 2 of 2) correctly', async () => {
setup();
diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.tsx
index 57d8ee5a41..93476a53b7 100644
--- a/superset-frontend/src/features/databases/DatabaseModal/index.tsx
+++ b/superset-frontend/src/features/databases/DatabaseModal/index.tsx
@@ -1069,6 +1069,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
// eslint-disable-next-line camelcase
(db: DatabaseObject) => db.name === database_name,
)[0];
+ if (!selectedDbModel) return;
const {
engine,
parameters,