Skip to content

Conversation

@msyavuz
Copy link
Member

@msyavuz msyavuz commented Dec 3, 2025

SUMMARY

When saving a chart from the explore view and choosing "Save & go to dashboard", the chart's state from the explore view was persisting in Redux store and affecting the dashboard's chart rendering. This fix ensures that the chart state is properly cleaned up before navigating to the dashboard.

The issue occurs because the explore view's chart state remains in Redux when navigating directly to a dashboard. By dispatching removeChartState before navigation, we ensure a clean state transition.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A - This is a state management fix that prevents incorrect chart rendering

TESTING INSTRUCTIONS

  1. Go to explore view and create/edit a chart
  2. Click "Save"
  3. Select a dashboard from the dropdown
  4. Click "Save & go to dashboard"
  5. Verify that the chart renders correctly in the dashboard without any state issues from the explore view

Unit Test:
A new unit test has been added to verify that removeChartState is dispatched when saving and navigating to a dashboard. Run:

npm run test -- src/explore/components/SaveModal.test.jsx -t "dispatches removeChartState"

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI (prevents chart rendering issues)
  • 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

Prevent saved chart settings in Explore from leaking into the dashboard view

What Changed

  • When using “Save & go to dashboard” from Explore, the temporary chart state from Explore is cleared before opening the dashboard so the chart renders with the dashboard’s own settings
  • Added an automated test to ensure the chart state is cleared and navigation to the dashboard still works as expected

Impact

✅ Correct chart rendering after Save & go to dashboard
✅ Fewer stale explore settings appearing on dashboards
✅ More reliable dashboard view after saving charts

💡 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.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 3, 2025

Code Review Agent Run #5ca936

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: c61be6d..2d4f0ed
    • superset-frontend/src/explore/components/SaveModal.test.jsx
    • superset-frontend/src/explore/components/SaveModal.tsx
  • Files skipped - 0
  • Tools
    • 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 Default Agent 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 change:frontend Requires changing the frontend explore:save Related to saving changes in Explore labels Dec 3, 2025
@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:M This PR changes 30-99 lines, ignoring generated files label Dec 3, 2025
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Possible Bug
    The test that spies on dashboardStateActions.removeChartState also calls dashboardStateActions.removeChartState(chartId) inside an assertion. This additional call can cause the spy assertion to pass even if saveOrOverwrite never invokes removeChartState, weakening the test and potentially hiding regressions in the cleanup logic.

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

CodeAnt AI finished reviewing your PR.

The test was incorrectly calling removeChartState inside the assertion,
which would cause the spy to record the call and make the test pass
even if the actual implementation didn't call it.
Copy link
Contributor

@alexandrusoare alexandrusoare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I will test it locally as well

@geido geido merged commit b40467c into master Dec 3, 2025
90 of 92 checks passed
@geido geido deleted the msyavuz/fix/reset-chart-state branch December 3, 2025 15:30
@sadpandajoe sadpandajoe added the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Dec 3, 2025
sadpandajoe pushed a commit that referenced this pull request Dec 3, 2025
@sadpandajoe sadpandajoe removed the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Dec 3, 2025
sadpandajoe pushed a commit that referenced this pull request Dec 4, 2025
Facyla pushed a commit to Facyla/superset-contrib that referenced this pull request Dec 16, 2025
sadpandajoe pushed a commit that referenced this pull request Dec 16, 2025
aminghadersohi pushed a commit to aminghadersohi/superset that referenced this pull request Jan 17, 2026
aminghadersohi pushed a commit to aminghadersohi/superset that referenced this pull request Jan 24, 2026
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 explore:save Related to saving changes in Explore size/M size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants