Skip to content

fix(DatabaseModal): prevent errors when pasting text into supported database select#35916

Merged
EnxDev merged 6 commits into
masterfrom
enxdev/fix/db-connection-modal
Nov 5, 2025
Merged

fix(DatabaseModal): prevent errors when pasting text into supported database select#35916
EnxDev merged 6 commits into
masterfrom
enxdev/fix/db-connection-modal

Conversation

@EnxDev
Copy link
Copy Markdown
Contributor

@EnxDev EnxDev commented Oct 30, 2025

SUMMARY

Problem
When creating a new database connection, users must select the database engine/type from a dropdown.
Currently, pasting a value into this dropdown causes an error.

Solution
This PR fixes the issue by filtering pasted text against the supported database values, preventing errors and
adds a test to ensure that pasting text into the supported database select field correctly filters the available options, preventing the regression of the previous paste-related error.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  1. All tests should pass
  2. Navigate to Settings > Database Connections.
  3. Paste a value in the Supported Databases dropdown.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Oct 30, 2025

Code Review Agent Run #af3f5d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: d987d1f..d987d1f
    • superset-frontend/src/features/databases/DatabaseModal/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Oct 30, 2025
Copy link
Copy Markdown

@korbit-ai korbit-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completed my review and didn't find any issues.

Files scanned
File Path Reviewed
superset-frontend/src/features/databases/DatabaseModal/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@EnxDev EnxDev added 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR and removed change:frontend Requires changing the frontend labels Oct 30, 2025
@github-actions github-actions Bot added 🎪 d987d1f 🚦 building and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Oct 30, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for d987d1f

@bito-code-review
Copy link
Copy Markdown
Contributor

Interaction Diagram by Bito
sequenceDiagram
participant User as User/Component
participant Modal as DatabaseModal<br/>🔄 Updated | ●●○ Medium
participant Select as Select Component
participant SetDb as setDatabaseModel<br/>🔄 Updated | ●●○ Medium
participant Reducer as dbReducer
participant State as Database State
User->>Modal: Render DatabaseModal
User->>Select: Select database from dropdown
Select->>SetDb: onChange(database_name)
SetDb->>SetDb: Filter availableDbs for match
Note over SetDb: Added null check:<br/>if (!selectedDbModel) return
SetDb->>Reducer: setDB(DbSelected action)
Reducer->>State: Update database state
State-->>Modal: Re-render with config
Loading

Critical path: User/Component -> DatabaseModal -> Select Component -> setDatabaseModel (MODIFIED) -> dbReducer -> Database State

Note: Added null check in setDatabaseModel function to prevent undefined reference errors when database lookup fails. This defensive guard returns early if no matching database is found, protecting downstream property access.

@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for d987d1f

Environment: http://35.161.248.34:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@sadpandajoe sadpandajoe added the review:checkpoint Last PR reviewed during the daily review standup label Oct 30, 2025
Copy link
Copy Markdown
Member

@msyavuz msyavuz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can we have some tests?

@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for f00802a

@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for f00802a

Environment: http://34.221.22.254:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@rusackas rusackas removed the review:checkpoint Last PR reviewed during the daily review standup label Nov 3, 2025
Comment on lines +440 to +446
fireEvent.paste(selectInput, {
clipboardData: {
getData: () => 'post',
},
});

fireEvent.change(selectInput, { target: { value: 'post' } });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Do we not just trigger onChange with a setup like this?

Suggested change
fireEvent.paste(selectInput, {
clipboardData: {
getData: () => 'post',
},
});
fireEvent.change(selectInput, { target: { value: 'post' } });
fireEvent.paste(selectInput, {
clipboardData: {
getData: () => 'post',
},
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified the test, when text is pasted into the select, it verifies that no exceptions are thrown

@pull-request-size pull-request-size Bot added size/S and removed size/M labels Nov 5, 2025
Copy link
Copy Markdown
Member

@msyavuz msyavuz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@EnxDev EnxDev merged commit 1f960d5 into master Nov 5, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch 🍒 6.0.0 Cherry-picked to 6.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants