massucattoj opened a new pull request, #41019:
URL: https://github.com/apache/superset/pull/41019

   ### 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
   <img width="2056" height="892" alt="Screenshot 2026-06-13 at 12 08 16" 
src="https://github.com/user-attachments/assets/b8d1127f-9fd0-44a0-9b3b-0c525462417d";
 />
   
   ### TESTING INSTRUCTIONS
   
   1. Access the Workspace.
   2. Navigate to SQL > SQL Lab.
   3. Execute a few queries.
   4. Refresh the page to make sure they'll show up in the Query History tab.
   5. Navigate to the Query History.
   6. Delete an entry from the list.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to