Skip to content

fix(explore): match dashboard names case-insensitively in the Save modal - #45168

Open
hadimobarra wants to merge 8 commits into
apache:masterfrom
hadimobarra:fix/issue-44873-duplicate-dashboard
Open

hadimobarra wants to merge 8 commits into
apache:masterfrom
hadimobarra:fix/issue-44873-duplicate-dashboard

Conversation

@hadimobarra

@hadimobarra hadimobarra commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Follow-up to #44894 for the dashboard picker case originally reported in #44873.

#44894 removes an optimistic "new" option when the server returns the same label, comparing labels exactly (after trimming). In Explore's "Save chart" modal, typing test dashboard when Test Dashboard exists still offers both, so a near-duplicate dashboard can be created by accident.

This PR adds an opt-in caseSensitiveNewOptionMatching prop to AsyncSelect (default true) and sets it to false in SaveModal:

Trade-off: in this picker, a dashboard whose title differs only by case from one the user can see in the list can no longer be created.

TESTING INSTRUCTIONS

  1. Have a dashboard titled Test Dashboard.
  2. Open a chart in Explore, click Save, and type test dashboard in the dashboard select.
  3. Once results load, only Test Dashboard is listed, with no "New" entry.

Automated:

  • Run against master's AsyncSelect, 3 of the PR's tests fail, all for case-insensitive matching. With this change, AsyncSelect.test.tsx passes (97 tests).
  • Before the last test was added, the Select, SaveModal and NotificationMethod suites passed together (298 tests).
  • oxfmt, oxlint and tsc --build packages/superset-ui-core pass.

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

@netlify

netlify Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 1e52e4d
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae2d092daf378b9942b6103
😎 Deploy Preview https://deploy-preview-45168--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 48d07b0c3af0

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 10, 2026
…sitive matching (apache#44873)

Fixes apache#44873

When using AsyncSelect with allowNewOptions enabled (e.g., in Save Chart modal),
users could accidentally create duplicate dashboards:
- Typing 'my dashboard' shows it as a new option
- Server returns 'My dashboard' (existing)
- Both appear in dropdown, allowing duplicate creation

Implemented three-layer deduplication with case-insensitive label matching:

1. **Fetch Response Handler**: Filters isNewOption entries that match
   server data (case-insensitive) when fetch completes

2. **fullSelectOptions Memo**: Optimized filtering to remove isNewOption
   duplicates before display (early exit if no new options)

3. **handleOnSearch**: Refactored to use functional state updates,
   checks for case-insensitive matches before creating new options,
   removes previous unselected isNewOption entries

- Added 4 comprehensive test cases covering:
  - Exact label match deduplication ✅
  - Preserving legitimate new options ✅
  - Whitespace trimming ✅
  - Case-insensitive matching (known edge case, documented)
- All 79 existing tests pass, no regressions

- Prevents accidental duplicate dashboard creation
- Aligns UI behavior with database case-insensitive lookups
- Improves UX by showing canonical dashboard names
@hadimobarra
hadimobarra force-pushed the fix/issue-44873-duplicate-dashboard branch from 8734d6f to 5906a35 Compare October 12, 2026 13:49
@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.97%. Comparing base (de11628) to head (48d07b0).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...rset-ui-core/src/components/Select/AsyncSelect.tsx 92.85% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45168      +/-   ##
==========================================
- Coverage   85.97%   85.97%   -0.01%     
==========================================
  Files        3128     3127       -1     
  Lines      217773   217731      -42     
  Branches    51629    51630       +1     
==========================================
- Hits       187230   187189      -41     
+ Misses      27119    27118       -1     
  Partials     3424     3424              
Flag Coverage Δ
javascript 82.79% <92.85%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 12, 2026

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The race is real, and moving the search handler to a functional setSelectOptions is the right way to stop the optimistic option surviving a late response.

Two things inline: how far the label matching reaches, since this is the shared component, and a possible regression from dropping fullSelectOptions.

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Scoping this behind a prop is the right call, and the fullSelectOptions check in handleOnSearch looks right to me now.

The gate didn't quite reach mergeData though, so default-mode callers still get the case-insensitive dedupe on some paths. Notes inline on that, the test that leans on it, and the block oxfmt is rewriting (that's the red pre-commit). check-openapi-spec-drift looks unrelated to a frontend-only change.

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Everything from the last round is in: mergeData is gated with the prop in its deps, the base-fetch test sets the prop and has a default-mode twin, the selected-option path has its own test, and the prop lives on AsyncSelectProps. CI is green.

One thing left inline, in the search handler: a stale optimistic option can block the create option when the user fixes the casing of what they typed.

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The casing fix does what it should: unselected optimistic options from earlier keystrokes no longer count as a match, and selected ones still do, so retyping my dashboard as My Dashboard keeps the create option. The new test would come back empty without the change, so it actually pins it.

Nothing else from me, every earlier thread is covered. CI was still running when I looked.

@EnxDev

EnxDev commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

I'm pinging @michael-s-molina and @msyavuz since they've worked extensively on the AsyncSelect

@hadimobarra

Copy link
Copy Markdown
Contributor Author

The latest review found no remaining code issues. Could a committer please approve and rerun the failed CI jobs? test-storybook failed because no Storybook server was available on port 6006, and the Playwright failures look unrelated to this AsyncSelect change.

@hadimobarra

hadimobarra commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Merged the latest upstream/master into this branch; the net PR diff remains limited to the AsyncSelect dashboard-name matching fix and tests. Targeted Jest (86 tests), oxfmt, and oxlint pass. All review threads are resolved. @michael-s-molina @msyavuz, could you please approve the updated branch once CI completes?

@hadimobarra

hadimobarra commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

CI update: both required Playwright jobs and all GAQ jobs pass on commit 552e88e. The sole remaining failure is sharded-jest-tests (2): src/explore/components/controls/ColumnConfigControl/ColumnConfigControl.popover.test.tsx, test 'does not read back a config stored under the alias' at line 292. This file is outside the PR diff; src/explore/components/SaveModal.test.tsx passed in the same shard. I do not have permission to rerun it. Could a committer rerun the failed frontend job, then approve if green?

Resolve conflicts with apache#44894 by extending its isRedundantNewOption helper
with the opt-in case-insensitive matching, leaving default matching as is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@hadimobarra hadimobarra changed the title fix(AsyncSelect): prevent duplicate dashboard entries with case-insensitive matching fix(explore): match dashboard names case-insensitively in the Save modal Nov 24, 2026
@hadimobarra

Copy link
Copy Markdown
Contributor Author

Merged the latest master and resolved the conflicts with #44894. That PR covers exact-label duplicates, so this one is now a small follow-up: opt-in case-insensitive matching for the Save modal's dashboard picker, built on the isRedundantNewOption helper from #44894. Default behavior is unchanged for other callers. I updated the title and description to match.

@rusackas, you mentioned preferring the narrower approach in #44873. Is the case-insensitive part still wanted? If so, a review would be appreciated; if not, I'm happy to close this.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants