Skip to content

fix: delete Chart under "All" in home page doesn't refresh after dele…#39471

Open
AoLiGei1221 wants to merge 25 commits intoapache:masterfrom
AoLiGei1221:master
Open

fix: delete Chart under "All" in home page doesn't refresh after dele…#39471
AoLiGei1221 wants to merge 25 commits intoapache:masterfrom
AoLiGei1221:master

Conversation

@AoLiGei1221
Copy link
Copy Markdown
Contributor

SUMMARY

According to #39428, this PR fixes a UI refresh issue when deleting charts from the homepage.

Unexpected Behavior:
When deleting a chart under tabs such as "All", the homepage does not update, and the deleted chart remains visible until a manual refresh.

Expected Behavior:
After deleting a chart, the homepage should immediately reflect the updated chart list across all tabs.

Root Cause:
On the homepage, chart data may be initialized using initialData, which bypasses the fetch lifecycle in useListViewResource. As a result, lastFetchDataConfig is not initialized. When refreshData() is called without arguments, it becomes a no-op and does not trigger a data refresh.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After deletion, the home page immediately reflect the changes.

TESTING INSTRUCTIONS

  1. Go to the Superset homepage
  2. Navigate to the "All" tab (or any non-"Mine" tab)
  3. Delete a chart
  4. Verify that the chart list refreshes immediately and the deleted chart is removed from the UI
  5. Repeat the same steps under the "Mine" tab to confirm existing behavior remains unchanged

ADDITIONAL INFORMATION

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 20, 2026

Code Review Agent Run #8ad1a5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 1f774f8..1f774f8
    • superset-frontend/src/features/charts/ChartCard.tsx
    • superset-frontend/src/features/home/ChartTable.tsx
    • superset-frontend/src/views/CRUD/utils.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

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Apr 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.58%. Comparing base (f6c5219) to head (8cba9d6).

Files with missing lines Patch % Lines
superset-frontend/src/features/home/ChartTable.tsx 90.90% 1 Missing ⚠️
superset-frontend/src/views/CRUD/utils.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39471   +/-   ##
=======================================
  Coverage   64.58%   64.58%           
=======================================
  Files        2564     2564           
  Lines      133558   133571   +13     
  Branches    31031    31037    +6     
=======================================
+ Hits        86254    86272   +18     
+ Misses      45812    45807    -5     
  Partials     1492     1492           
Flag Coverage Δ
javascript 66.55% <86.66%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@AoLiGei1221
Copy link
Copy Markdown
Contributor Author

It looks like not my fault. Could someone help me re-run the CI/CD to check? Thank you!

@rusackas
Copy link
Copy Markdown
Member

It seems that things work for dashboards but not for charts in terms of what you're expecting here.Let's see if we can add a failing test for the deletion of charts that gets fixed by this patch.We should also make sure that we're following the same React code patterns that we're using for dashboards in this chart implementation.We might also want to look at saved queries while we're at it if that's going to have a similar problem.If there's any code that can be reused across any and all deletions in the homepage, that would be ideal.

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Apr 20, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 20, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit bec4f1e
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69e678c1b317ab0008630972
😎 Deploy Preview https://deploy-preview-39471--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 20, 2026

Code Review Agent Run #232926

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 1f774f8..9a20172
    • superset-frontend/src/features/charts/ChartCard.tsx
    • superset-frontend/src/features/home/ChartTable.test.tsx
    • superset-frontend/src/features/home/ChartTable.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

@AoLiGei1221
Copy link
Copy Markdown
Contributor Author

Hey @rusackas , Thanks for the feedback! I’ve aligned the chart deletion flow with the dashboard pattern. I also added a regression test covering deletion on ALL tabs to ensure the list refreshes correctly. Please check again. Thank you so much!

Screen.Recording.2026-04-20.at.16.35.04.mov

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 20, 2026

Code Review Agent Run #c2332b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 9a20172..e88d515
    • superset-frontend/src/features/home/ChartTable.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

menuItems.push({
key: 'delete',
label: (
label: onDelete ? (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this a whole new button? If so, can we see it in a screenshot?

);
});

test('refreshes other tab data after deleting a chart', async () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for adding tests.

@bito-code-review
Copy link
Copy Markdown
Contributor

No, this isn't a whole new button. The change modifies the existing delete option in the chart card menu to optionally use a custom onDelete handler for direct deletion, instead of the default confirmation dialog. I can't provide screenshots as I'm a text-based assistant.

},
]}
/>
{chartToDelete && (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just checking here, do the other delete buttons have the same kind of modal?If so, is there any code we can reuse here to keep things simple?

@rusackas rusackas added the 🎪 ⚡ showtime-trigger Trigger showtime deployment label Apr 21, 2026
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 the Superset homepage chart list not refreshing after deleting a chart from non-“Mine” tabs when the list is bootstrapped from initialData (so useListViewResource.refreshData() is a no-op without an explicit fetch config).

Changes:

  • Adds an optional refreshDataConfig argument to handleChartDelete so callers can force a refresh even when lastFetchDataConfig was never initialized.
  • Updates the homepage ChartTable to drive chart deletion via a DeleteModal and pass an explicit fetch config to handleChartDelete.
  • Adds a regression test covering deletion + refresh behavior on the “All” (other) tab.

Reviewed changes

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

File Description
superset-frontend/src/views/CRUD/utils.tsx Extends handleChartDelete to optionally refresh with an explicit FetchDataConfig.
superset-frontend/src/features/home/ChartTable.tsx Adds delete modal flow and passes a concrete fetch config to ensure refresh works with initialData.
superset-frontend/src/features/home/ChartTable.test.tsx Adds a regression test verifying delete triggers a refetch and removes the deleted chart from the UI.
superset-frontend/src/features/charts/ChartCard.tsx Adds an onDelete hook to let parents (homepage) control deletion UX and refresh behavior.
Comments suppressed due to low confidence (1)

superset-frontend/src/views/CRUD/utils.tsx:347

  • In handleChartDelete, the fallback refresh config for the "Mine" tab builds a filter on created_by (rel_o_m). For charts on the homepage, "Mine" filtering is done via owners (rel_m_m) in getFilterValues, so this branch can refresh the list with a different set of charts than the tab is showing. Consider aligning this filter with the homepage/tab logic (use owners + rel_m_m, or reuse the same filter builder) so a delete always refreshes to the correct dataset when refreshDataConfig isn’t provided.
  const filters = {
    pageIndex: 0,
    pageSize: PAGE_SIZE,
    sortBy: [
      {
        id: 'changed_on_delta_humanized',
        desc: true,
      },
    ],
    filters: [
      {
        id: 'created_by',
        operator: 'rel_o_m',
        value: `${userId}`,
      },
    ],

Comment on lines +128 to +143
label: onDelete ? (
<div
data-test="chart-list-delete-option"
role="button"
tabIndex={0}
className="action-button"
onClick={() => onDelete(chart)}
>
<Icons.DeleteOutlined
iconSize="l"
css={css`
vertical-align: text-top;
`}
/>{' '}
{t('Delete')}
</div>
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

The new onDelete menu label is a focusable <div role="button" tabIndex={0}> with only an onClick handler. This is not keyboard-activatable (Enter/Space) and may not fire when antd Menu items are activated via keyboard navigation. Prefer wiring deletion through the MenuItem’s onClick (or render a <Button>/add onKeyDown handling) so the action works for keyboard users as well.

Copilot uses AI. Check for mistakes.
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 22, 2026

Code Review Agent Run #f39f4c

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/features/charts/ChartCard.tsx - 1
    • Inconsistent menu item event handling · Line 125-135
      The diff changes the delete menu item's structure to place onClick on the MenuItem and removes role='button' and tabIndex from the inner div, while edit and export menu items retain onClick on their inner divs with these attributes. This introduces inconsistency in how menu items handle user interactions and accessibility, potentially confusing maintainers and affecting keyboard navigation uniformity.
Review Details
  • Files reviewed - 1 · Commit Range: e88d515..8cba9d6
    • superset-frontend/src/features/charts/ChartCard.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

change:frontend Requires changing the frontend 🎪 🔒 showtime-blocked 🎪 ⚡ showtime-trigger Trigger showtime deployment size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete Chart under "All" in home page doesn't reload interface

3 participants