Skip to content

fix(dashboard): offer Exit edit mode when there is nothing to discard#42208

Open
rusackas wants to merge 1 commit into
apache:masterfrom
rusackas:fix/dashboard-exit-edit-mode-pristine
Open

fix(dashboard): offer Exit edit mode when there is nothing to discard#42208
rusackas wants to merge 1 commit into
apache:masterfrom
rusackas:fix/dashboard-exit-edit-mode-pristine

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Follow-up to #40832, which disabled the Discard button when a dashboard edit session has no unsaved changes. That fixed the misleading affordance (Discard had nothing to discard), but as @sadpandajoe noted on that PR, it left the edit-mode toolbar with no way back to view mode on a pristine session: Save and Discard are both disabled, and the "..." menu has no exit item, so the only escape is a page refresh or navigating away.

This keeps the button always enabled, and swaps the label based on state: Discard when there are unsaved changes, Exit edit mode when there are none. The click handler is identical in both cases (drops the ?edit param and returns to view mode), so the label always describes what actually happens.

If @yousoph / @kasiazjc would rather see a different treatment (a separate exit control, different wording, etc.), happy to iterate. This is meant as the smallest change that removes the dead end.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: on a pristine edit session, Discard is disabled and there is no toolbar path back to view mode.
After: the same button reads "Exit edit mode" and is clickable; with unsaved changes it reads "Discard" exactly as before.

TESTING INSTRUCTIONS

  1. Open any dashboard and click Edit dashboard.
  2. Without changing anything, confirm the secondary button reads Exit edit mode and is enabled; clicking it returns to view mode.
  3. Re-enter edit mode and make a change (drag a chart, rename). Confirm the button now reads Discard and discards on click.
  4. Undo/redo and Save behavior are unchanged.

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

🤖 Generated with Claude Code

Follow-up to apache#40832, which disabled the Discard button when a dashboard
edit session has no unsaved changes. That fixed the misleading label but
left the toolbar with no way back to view mode on a pristine session
(Save and Discard both disabled, and the actions menu has no exit item).

Keep the button always enabled instead, labeled Discard when there are
unsaved changes and Exit edit mode when there are none. The handler is
unchanged in both cases: it drops the ?edit param and returns to view
mode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added change:frontend Requires changing the frontend dashboard:editmode Related to te Dashboard edit mode labels Jul 18, 2026
@bito-code-review

bito-code-review Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #03edc2

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/dashboard/components/Header/Header.test.tsx - 1
    • Test coverage gap for button click · Line 525-527
      The test at line 525 only verifies the button is enabled, but doesn't validate the click behavior when there are no unsaved changes. Add assertions to verify that clicking the button triggers the expected navigation (e.g., checking that the edit URL parameter is removed).
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/dashboard/components/Header/index.tsx - 1
Review Details
  • Files reviewed - 2 · Commit Range: f898981..f898981
    • superset-frontend/src/dashboard/components/Header/Header.test.tsx
    • superset-frontend/src/dashboard/components/Header/index.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 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

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.18%. Comparing base (751f5eb) to head (f898981).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42208      +/-   ##
==========================================
- Coverage   65.19%   65.18%   -0.01%     
==========================================
  Files        2767     2767              
  Lines      156062   156064       +2     
  Branches    35717    35719       +2     
==========================================
- Hits       101741   101737       -4     
- Misses      52361    52367       +6     
  Partials     1960     1960              
Flag Coverage Δ
javascript 70.82% <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.

@sadpandajoe sadpandajoe added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jul 19, 2026
@github-actions github-actions Bot added 🎪 f898981 🚦 building 🎪 f898981 📅 2026-07-19T05-42 Environment f898981 created at 2026-07-19T05-42 🎪 f898981 🤡 sadpandajoe Environment f898981 requested by sadpandajoe 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for f898981

@github-actions github-actions Bot added 🎪 f898981 🚦 deploying 🎪 f898981 🚦 running Environment f898981 status: running 🎪 f898981 🌐 34.220.202.197:8080 Environment f898981 URL: http://34.220.202.197:8080 (click to visit) and removed 🎪 f898981 🚦 building 🎪 f898981 🚦 running Environment f898981 status: running labels Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for f898981

Environment: http://34.220.202.197:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

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 dashboard:editmode Related to te Dashboard edit mode 🎪 f898981 🚦 running Environment f898981 status: running 🎪 f898981 🤡 sadpandajoe Environment f898981 requested by sadpandajoe 🎪 f898981 🌐 34.220.202.197:8080 Environment f898981 URL: http://34.220.202.197:8080 (click to visit) 🎪 f898981 📅 2026-07-19T05-42 Environment f898981 created at 2026-07-19T05-42 size/S 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants