Skip to content

fix(dashboard): prevent divider display controls from reverting on second save#40696

Merged
yousoph merged 3 commits into
apache:masterfrom
preset-io:fix/sc-85682-divider-edit-revert
Jun 5, 2026
Merged

fix(dashboard): prevent divider display controls from reverting on second save#40696
yousoph merged 3 commits into
apache:masterfrom
preset-io:fix/sc-85682-divider-edit-revert

Conversation

@yousoph
Copy link
Copy Markdown
Member

@yousoph yousoph commented Jun 3, 2026

SUMMARY

Fixes a bug where editing a dashboard divider's title/description in the "Add or edit display controls" modal causes the panel to revert to the first-saved values on subsequent saves, and the Save button to start disabled on every reopen after the first save.

Root cause (two-part):

DividerConfigForm never calls handleModifyItem when the user types — unlike FiltersConfigForm, which calls it via its formChanged/onModifyFilter path. This caused two symptoms:

  1. Save button disabled on reopen. After the first save, changes.modified is reset to []. On modal reopen the save button's canSave check requires changes.modified.length > 0, which never becomes true because no code marks the divider modified when the user types.

  2. Values revert on save. When save is triggered, resetForm(true) resets all antd fields back to initialValue. Since the divider was never added to changes.modified, its updated value is excluded from the save payload and the display reverts to the previously saved title.

Fix: In FiltersConfigModal.tsx, update handleValuesChange (wired to Form.onValuesChange) to detect when a changed field key belongs to a divider (NATIVE_FILTER_DIVIDER-* or CHART_CUSTOMIZATION_DIVIDER-*) and call handleModifyItem for that ID. This mirrors the existing pattern in FiltersConfigForm without requiring changes to DividerConfigForm or any renderer components.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — logic fix, no visual change to the modal layout.

TESTING INSTRUCTIONS

  1. Open a dashboard in edit mode
  2. Click "Add or edit display controls" to open the filters/display modal
  3. Add a new Divider item from the left sidebar
  4. Enter a title (e.g. "First Title") and click Save — first save should work
  5. Re-open the modal; confirm the divider shows "First Title"
  6. Edit the title to "Second Title" — the Save button should enable immediately after typing
  7. Click Save — confirm the panel shows "Second Title" (no revert to "First Title")
  8. Re-open and confirm "Second Title" persists

Repeat with a chart customization divider (CHART_CUSTOMIZATION_DIVIDER-*) to confirm both prefixes are covered.

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

…sc-85682)

DividerConfigForm does not call handleModifyItem on form value changes the
way FiltersConfigForm does via its onModifyFilter prop. As a result, editing a
saved divider's title/description on a second modal open left the divider
absent from changes.modified, keeping canSave false and causing resetForm to
revert the displayed values back to the prior saved state after any save.

Fix: detect divider field changes in handleValuesChange (Form.onValuesChange)
and call handleModifyItem for the affected divider ID, ensuring it enters
changes.modified so canSave becomes true and the save payload includes the
updated values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added the dashboard:native-filters Related to the native filters of the Dashboard label Jun 3, 2026
Copy link
Copy Markdown
Contributor

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #d51bc7

Actionable Suggestions - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx - 1
Review Details
  • Files reviewed - 2 · Commit Range: 1be9916..1be9916
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.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

await userEvent.clear(titleInput);
await userEvent.type(titleInput, 'Second Edit');

jest.advanceTimersByTime(1000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Incorrect timer advancement

Timer advances by 1000ms but Constants.SLOW_DEBOUNCE is 500ms. Use 500ms to match the actual debounce delay and avoid unnecessary waiting.

Code suggestion
Check the AI-generated fix before applying
 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
 +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
 @@ -840,7 +840,7 @@ test('enables save button and includes updated title when editing an existing d
    await userEvent.type(titleInput, 'Second Edit');
 
 -  jest.advanceTimersByTime(1000);
 +  jest.advanceTimersByTime(500);
    jest.useRealTimers();
 
    await waitFor(() =>

Code Review Run #d51bc7


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.16%. Comparing base (108e40c) to head (c1e8469).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40696      +/-   ##
==========================================
+ Coverage   64.13%   64.16%   +0.03%     
==========================================
  Files        2666     2666              
  Lines      143979   143983       +4     
  Branches    33105    33107       +2     
==========================================
+ Hits        92337    92383      +46     
+ Misses      50034    49990      -44     
- Partials     1608     1610       +2     
Flag Coverage Δ
javascript 67.81% <100.00%> (+0.06%) ⬆️

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a dashboard “display controls” modal bug where edits to divider title/description weren’t marked as modified, causing the Save button to remain disabled on reopen and (on subsequent saves) divider values to revert to previously-saved content.

Changes:

  • Update FiltersConfigModal onValuesChange handling to detect divider field edits and call handleModifyItem for the divider ID.
  • Add a regression test ensuring editing an existing native filter divider enables Save and persists the updated title in the save payload.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx Marks divider items as modified when divider form fields change so the Save button enables and payload includes updated divider values.
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx Adds regression coverage for editing an existing NATIVE_FILTER_DIVIDER-* item and verifying save payload contains the new title.

Comment on lines +803 to +807
test('enables save button and includes updated title when editing an existing divider', async () => {
jest.useFakeTimers();

const nativeFilterDividerConfig = [
{
…ge (sc-85682)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jun 3, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Jun 3, 2026

Code Review Agent Run #426018

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 1be9916..3a6196d
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.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

@yousoph yousoph requested a review from kgabryje June 4, 2026 19:00
Copy link
Copy Markdown
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM

@yousoph yousoph merged commit e956f82 into apache:master Jun 5, 2026
63 checks passed
@yousoph yousoph deleted the fix/sc-85682-divider-edit-revert branch June 5, 2026 18:36
@bito-code-review
Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

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

Labels

dashboard:native-filters Related to the native filters of the Dashboard size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants