Repository navigation
fix(explore): match dashboard names case-insensitively in the Save modal - #45168
hadimobarra wants to merge 8 commits into
Conversation
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…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
8734d6f to
5906a35
Compare
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
EnxDev
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
|
I'm pinging @michael-s-molina and @msyavuz since they've worked extensively on the AsyncSelect |
|
The latest review found no remaining code issues. Could a committer please approve and rerun the failed CI jobs? |
|
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? |
|
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]>
|
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 @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. |
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 dashboardwhenTest Dashboardexists still offers both, so a near-duplicate dashboard can be created by accident.This PR adds an opt-in
caseSensitiveNewOptionMatchingprop toAsyncSelect(defaulttrue) and sets it tofalseinSaveModal:isRedundantNewOptionhelper from fix(select): comprehensive hardening for option deduplication and new option handling #44894 instead of adding a parallel path.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
Test Dashboard.test dashboardin the dashboard select.Test Dashboardis listed, with no "New" entry.Automated:
master'sAsyncSelect, 3 of the PR's tests fail, all for case-insensitive matching. With this change,AsyncSelect.test.tsxpasses (97 tests).Select,SaveModalandNotificationMethodsuites passed together (298 tests).tsc --build packages/superset-ui-corepass.ADDITIONAL INFORMATION
🤖 Generated with Claude Code