fix(sqllab): reflect query history deletion without page refresh#41019
fix(sqllab): reflect query history deletion without page refresh#41019massucattoj wants to merge 1 commit into
Conversation
Code Review Agent Run #42e0c2Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41019 +/- ##
=======================================
Coverage 64.28% 64.28%
=======================================
Files 2659 2659
Lines 144300 144307 +7
Branches 33260 33261 +1
=======================================
+ Hits 92760 92774 +14
+ Misses 49907 49900 -7
Partials 1633 1633
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:
|
SUMMARY
In SQL Lab's in-editor Query history tab (bottom panel), clicking the delete (trash) icon on a row didn't update the list — the row only disappeared after a full page refresh.
Root cause: removeQuery deletes the query on the backend and removes it from the Redux sqlLab.queries store, but it never updates the RTK Query editorQueries cache. The QueryHistory component merges both sources (Redux queries + the cached backend page) and re-concatenates data.result, so any row that came from the backend cache was immediately re-added after deletion — leaving the UI unchanged until a refetch on reload.
Fix: after a successful delete, optimistically remove the row from the editorQueries cache via updateQueryData, so the merged list reflects the deletion instantly.
I chose an optimistic cache update over invalidateTags(['EditorQueries']) on purpose: that endpoint uses infinite-scroll with a custom merge (currentCache.result.push(...)), so an invalidation-triggered refetch would re-append the page and duplicate rows.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION