Skip to content

fix(dashboard): sync chart description menu state with expanded_slices#41536

Open
durgaprasadml wants to merge 2 commits into
apache:masterfrom
durgaprasadml:fix-dashboard-expanded-slices-40373
Open

fix(dashboard): sync chart description menu state with expanded_slices#41536
durgaprasadml wants to merge 2 commits into
apache:masterfrom
durgaprasadml:fix-dashboard-expanded-slices-40373

Conversation

@durgaprasadml

Copy link
Copy Markdown
Contributor

SUMMARY

This PR fixes a regression introduced in Superset 6.1.0 where dashboard chart descriptions no longer remain expanded despite the chart being present in expanded_slices.

The root cause was that SliceHeaderControls uses the isDescriptionExpanded prop to determine whether to render “Show chart description” or “Hide chart description”, but SliceHeader was only passing isExpanded.

As a result, the menu state became desynchronized from the actual description state, causing the dropdown to always display “Show chart description” and making the toggle behavior appear broken.

BEFORE

  • Dashboard loads with:

{
"expanded_slices": {
"123": true
}
}

  • Description may already be expanded.
  • Dropdown incorrectly displays:

Show chart description

  • Clicking the option collapses the description, making the feature appear non-functional.

AFTER

  • Dashboard descriptions correctly reflect the persisted expansion state.
  • Dropdown labels remain synchronized with the actual description visibility.
  • Toggle behavior works as expected.

TESTING

Added regression coverage to verify:

  • Expanded descriptions display the correct menu state.
  • Toggle behavior updates labels correctly.
  • Existing dashboard functionality remains unchanged.

Fixes #40373

@dosubot dosubot Bot added the dashboard:component Related to the drag&drop components of the Dashboard label Jun 29, 2026
@bito-code-review

bito-code-review Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0fa68a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 19d7a50..19d7a50
    • superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
    • superset-frontend/src/dashboard/components/SliceHeader/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

@netlify

netlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

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

Comment on lines +458 to +461
expect(screen.getByTestId('SliceHeaderControls')).toHaveAttribute(
'data-is-description-expanded',
'false',
);

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.

Suggestion: This assertion only validates the default collapsed state, so it does not cover the regression scenario where a chart description is already expanded from expanded_slices. Add a test case with the expanded state set to true and verify the propagated description-expanded prop is true; otherwise this test can pass while the original menu-state desynchronization bug still exists. [incomplete implementation]

Severity Level: Major ⚠️
- ⚠️ Expanded descriptions menu label can regress unnoticed.
- ⚠️ Dashboard description toggle reliability depends on manual testing.
- ⚠️ Automated tests miss persisted expanded_slices behavior.
- ⚠️ Future refactors may desync description state and menu.
Steps of Reproduction ✅
1. Persist a dashboard with an expanded chart description so that its JSON metadata
contains `"expanded_slices": { <slice_id>: true }` (server-side write path in
`superset/daos/dashboard.py:343`), then load the dashboard in the UI so hydration uses
this value.

2. Observe that front-end hydration maps `metadata.expanded_slices` into Redux
`dashboardState.expandedSlices` in
`superset-frontend/src/dashboard/actions/hydrate.ts:377`, and that the Chart component
derives `isExpanded` from this field in `components/gridComponents/Chart/Chart.tsx:211`
and passes it to `SliceHeader` (verified via code analysis).

3. In `superset-frontend/src/dashboard/components/SliceHeader/index.tsx:354-356`,
`SliceHeader` passes `isExpanded` to `SliceHeaderControls` both as `isExpanded` and
`isDescriptionExpanded`, and `SliceHeaderControls` uses `props.isDescriptionExpanded` to
choose between “Hide chart description” and “Show chart description” in
`SliceHeaderControls/index.tsx:445-449`; if a regression reintroduces the earlier bug
(e.g., `isDescriptionExpanded` is incorrectly wired and remains false when the description
DOM is expanded), the dropdown label will be desynchronized from the actual description
state.

4. Run the current test suite: `SliceHeaderControls` tests cover only the “Show chart
description” path (`SliceHeaderControls.test.tsx:43-51` with `isDescriptionExpanded`
false), and the new `SliceHeader` test only asserts `data-is-description-expanded="false"`
(`SliceHeader.test.tsx:427-486`, lines 458-461). Even with the wiring bug reintroduced,
these tests still pass because no test renders a case where `expandedSlices` (and thus the
description) starts true and asserts `isDescriptionExpanded` is true, confirming the
suggestion that the added assertion validates only the collapsed state and misses the
expanded-state regression scenario.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
**Line:** 458:461
**Comment:**
	*Incomplete Implementation: This assertion only validates the default collapsed state, so it does not cover the regression scenario where a chart description is already expanded from `expanded_slices`. Add a test case with the expanded state set to true and verify the propagated description-expanded prop is true; otherwise this test can pass while the original menu-state desynchronization bug still exists.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The current test only verifies the collapsed state (isDescriptionExpanded='false'), leaving the expanded state untested and vulnerable to regressions where the menu label might desynchronize from the actual description state. To resolve this, add a test case that renders the component with isExpanded set to true and asserts that data-is-description-expanded is 'true'.

Here is a concise implementation for the test file:

test('Correct props to "SliceHeaderControls" when expanded', () => {
  render(<SliceHeader {...defaultProps} isExpanded={true} />);
  expect(screen.getByTestId('SliceHeaderControls')).toHaveAttribute(
    'data-is-description-expanded',
    'true',
  );
});

There are no other comments on this PR to address. Would you like me to check for any other potential test coverage gaps in this file?

superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx

test('Correct props to "SliceHeaderControls" when expanded', () => {
  render(<SliceHeader {...defaultProps} isExpanded={true} />);
  expect(screen.getByTestId('SliceHeaderControls')).toHaveAttribute(
    'data-is-description-expanded',
    'true',
  );
});

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.15789% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.57%. Comparing base (90fe1f5) to head (05b5e34).
⚠️ Report is 194 commits behind head on master.

Files with missing lines Patch % Lines
...ashboard/components/gridComponents/Chart/Chart.tsx 63.15% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41536      +/-   ##
==========================================
- Coverage   64.57%   64.57%   -0.01%     
==========================================
  Files        2664     2664              
  Lines      146369   146385      +16     
  Branches    33844    33847       +3     
==========================================
+ Hits        94521    94530       +9     
- Misses      50132    50139       +7     
  Partials     1716     1716              
Flag Coverage Δ
javascript 69.05% <63.15%> (-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 requested review from kgabryje and msyavuz June 30, 2026 17:21
@rusackas

rusackas commented Jul 5, 2026

Copy link
Copy Markdown
Member

Thanks @durgaprasadml for digging into #40373. I don't think this changes behavior though... isDescriptionExpanded={isExpanded} has been passed to SliceHeaderControls since late 2024, and the diff just moves the prop up the list. Tempted to close this out, but let me know if I'm misconstruing anything at all... the underlying issue does still need a real fix.

@durgaprasadml durgaprasadml force-pushed the fix-dashboard-expanded-slices-40373 branch from 19d7a50 to a2ed94f Compare July 5, 2026 08:23
@pull-request-size pull-request-size Bot added size/M and removed size/XS labels Jul 5, 2026
Comment thread superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx Outdated
@bito-code-review

bito-code-review Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #946e73

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: a2ed94f..a2ed94f
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.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

@bito-code-review

bito-code-review Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #525fe9

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: a2ed94f..05b5e34
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.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

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

Labels

dashboard:component Related to the drag&drop components of the Dashboard size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart descriptions not displaying on Dashboard in v6.1.0 (expanded_slices is true)

2 participants