Skip to content

fix(sqllab): reflect query history deletion without page refresh#41019

Open
massucattoj wants to merge 1 commit into
apache:masterfrom
massucattoj:fix/sqllab-query-history-delete-no-refresh
Open

fix(sqllab): reflect query history deletion without page refresh#41019
massucattoj wants to merge 1 commit into
apache:masterfrom
massucattoj:fix/sqllab-query-history-delete-no-refresh

Conversation

@massucattoj

Copy link
Copy Markdown
Contributor

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

Screenshot 2026-06-13 at 12 08 16

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

  • 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

@dosubot dosubot Bot added the sqllab Namespace | Anything related to the SQL Lab label Jun 13, 2026
@bito-code-review

bito-code-review Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #42e0c2

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: ce65849..ce65849
    • superset-frontend/src/SqlLab/actions/sqlLab.test.ts
    • superset-frontend/src/SqlLab/actions/sqlLab.ts
    • superset-frontend/src/hooks/apiResources/queries.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ 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 Superset 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

@netlify

netlify Bot commented Jun 13, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit ce65849
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a2d7272deacfa0008a4daf5
😎 Deploy Preview https://deploy-preview-41019--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.

@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.28%. Comparing base (9e7e1ec) to head (ce65849).
⚠️ Report is 5 commits behind head on master.

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           
Flag Coverage Δ
javascript 68.26% <100.00%> (+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.

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

Labels

size/M sqllab Namespace | Anything related to the SQL Lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant