Skip to content

fix: Stale editor content in @apache-superset/core#36813

Merged
rusackas merged 1 commit intoapache:masterfrom
michael-s-molina:fix-query-editor
Dec 23, 2025
Merged

fix: Stale editor content in @apache-superset/core#36813
rusackas merged 1 commit intoapache:masterfrom
michael-s-molina:fix-query-editor

Conversation

@michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Dec 23, 2025

User description

SUMMARY

Fix a bug in @apache-superset/core where the returned editor content was stale given that the implementation was not considering unsaved changes.

TESTING INSTRUCTIONS

CI should be sufficient.

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

CodeAnt-AI Description

Show unsaved query edits in SQL editor tabs

What Changed

  • When retrieving a SQL editor tab, the returned editor now includes any unsaved edits so the UI reflects the current in-memory content instead of the last saved state
  • No-op for tabs without unsaved changes; behavior only changes when there is an unsaved editor for the requested tab

Impact

✅ Visible unsaved changes in editor tabs
✅ Fewer stale-query displays when switching tabs
✅ Reduced confusion about lost edits

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@michael-s-molina michael-s-molina moved this from To Do to In Review in Superset Extensions Dec 23, 2025
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 23, 2025

Code Review Agent Run #dd49e8

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/core/sqlLab/index.ts - 1
    • Potential undefined override in merge · Line 67-68
      The merge of unsavedQueryEditor could override saved editor properties with undefined values if the unsaved state includes cleared fields. This might cause issues like undefined names being passed to createTab, potentially leading to UI errors or incorrect data. Consider filtering out undefined values during the merge.
Review Details
  • Files reviewed - 1 · Commit Range: 7f0a2bc..7f0a2bc
    • superset-frontend/src/core/sqlLab/index.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Dec 23, 2025
@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Dec 23, 2025
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Immutable ID overwrite
    The merge of unsavedQueryEditor into editor with a shallow spread may unintentionally override critical properties such as immutableId (or id) if the unsaved object contains undefined or different values. This can break predicate-based filtering and event routing that relies on immutable IDs.

  • Partial unsaved state
    If unsavedQueryEditor is partial (only contains content or name), the current merge is fine; but verify all callers expect the merged shape. Some callers rely on dbId/catalog/schema being present — ensure merging preserves those from the saved editor and does not create undefined values.

  • Over-broad merge
    Spreading the entire unsavedQueryEditor into editor may copy fields that are not intended to be surfaced (internal metadata), potentially exposing or altering state beyond editor content. Consider merging only the specific editor fields that represent user edits.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

@rusackas rusackas merged commit c399fd2 into apache:master Dec 23, 2025
97 of 100 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Superset Extensions Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/S size:XS This PR changes 0-9 lines, ignoring generated files

Projects

Development

Successfully merging this pull request may close these issues.

2 participants