Skip to content

fix(home): refresh recent activity after dashboard/chart delete - #45589

Draft
rusackas wants to merge 13 commits into
masterfrom
fix/39528-home-recent-activity-refresh
Draft

rusackas wants to merge 13 commits into
masterfrom
fix/39528-home-recent-activity-refresh

Conversation

@rusackas

@rusackas rusackas commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

SUMMARY

Refreshes the Home page's Recent Activity section automatically after a dashboard or chart is deleted, instead of requiring a manual page reload. This is a rebase + fix-up of @guptapuja's work in #39528, opened fresh because the token used here lacks the workflow scope needed to push directly to their fork.

Closes #39528 - thanks for the work here @guptapuja!

On top of the rebase, this adds one small fix and some test coverage that review rounds on the original PR had asked for:

  • ChartTable's delete flow calls getData(chartFilter) instead of refreshData whenever the active tab isn't "Mine" - that path was passing the raw, unwrapped getData through, so deleting a chart from the default/Other tab never fired the new onActivityRefresh callback at all. Wrapped it the same way DashboardTable already wraps its own getData (handleGetData).
  • Added test coverage for the onActivityRefresh wiring in both ChartTable.test.tsx and DashboardTable.test.tsx, which is what caught the gap above.

A later round added a Playwright E2E suite (playwright/tests/home/recent-activity-refresh.spec.ts) covering all six combinations of {Favorite, Mine, All} x {Dashboards, Charts}: create a throwaway asset, view it to seed a real Recents entry, delete it from that tab, and assert the Recents entry disappears promptly. See the PR comment below for how that came about.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

pr45589-demo-v2.mp4

(A cleaner recording is in progress - see the comment below.)

TESTING INSTRUCTIONS

  1. Go to the Home page.
  2. Delete a dashboard or chart from the Dashboards/Charts section (try the "Favorite", "Mine", and "All" tabs).
  3. Observe the Recent Activity / Recents section updates automatically, without a page reload, in every case.

Or run the new E2E suite: npx playwright test playwright/tests/home/recent-activity-refresh.spec.ts.

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

guptapuja and others added 6 commits October 21, 2026 13:01
- Added refreshKey state to trigger re-fetch of activity data
- Added onActivityRefresh callback prop to DashboardTable and ChartTable
- Activity section now updates automatically after delete operations

Fixes #39435
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- DashboardTable: only fire onActivityRefresh once the delete actually
  succeeds and triggers a real refetch, instead of immediately alongside
  the fire-and-forget delete call (which could race ahead of the backend
  delete and refresh with stale data).
- Home/Welcome: guard the recent-activity effect against out-of-order
  responses when refreshKey changes again before an in-flight refresh
  resolves, so an older response can no longer overwrite newer state.

Addresses CodeAnt review feedback on PR #39528.
handleChartDelete calls getData(chartFilter) instead of refreshData
whenever chartFilter is set and isn't 'Mine' (i.e. for the default
Other/All tab), but ChartTable was passing the raw, unwrapped getData
to that path - so deleting a chart from any tab other than Mine never
fired onActivityRefresh at all. DashboardTable already wraps its
equivalent getData call (handleGetData); mirrors that same fix here.

Also adds the test coverage for the onActivityRefresh wiring that was
asked for across review rounds - this exact gap only showed up once a
test exercised the non-Mine delete path.

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adopting this fix as a fresh PR since the OAuth token used here lacks
the `workflow` scope needed to push directly to the contributor's
fork. The preceding commits are unchanged aside from a rebase onto
current master, plus one follow-up fix (wrap getData in ChartTable so
the activity refresh covers all tabs, not just Mine) and test
coverage for the onActivityRefresh wiring that review rounds had
asked for.

Co-Authored-By: Puja Gupta <puja.ec676@gmail.com>
Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 26e5340ecdf0

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.11111% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.38%. Comparing base (2350348) to head (26e5340).
⚠️ Report is 58 commits behind head on master.

Files with missing lines Patch % Lines
superset-frontend/src/pages/Home/index.tsx 59.37% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45589      +/-   ##
==========================================
- Coverage   84.63%   84.38%   -0.26%     
==========================================
  Files        3069     3069              
  Lines      205446   202493    -2953     
  Branches    48306    47641     -665     
==========================================
- Hits       173879   170871    -3008     
- Misses      28277    28380     +103     
+ Partials     3290     3242      -48     
Flag Coverage Δ
javascript 80.82% <71.11%> (+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.

…ighten delete test

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

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

… guard

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e state on refresh

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@sadpandajoe sadpandajoe left a comment

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.

LGTM

@sadpandajoe

Copy link
Copy Markdown
Member

@rusackas PR says:

See #39528 for before/after screenshots.

but that PR doesn't have screenshots either. Mind adding them to your PR?

@SBIN2010 SBIN2010 left a comment

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.

LGTM!
I don’t think screenshots will provide the full picture here. You really need a video.

…g, drain async work instead of sleeping

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rusackas and others added 2 commits October 29, 2026 17:48
…d formatting

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds recent-activity-refresh.spec.ts, covering all six combinations
of {Favorite, Mine, All} x {Dashboards, Charts}: create a throwaway
asset, view it to seed a real Recents "Viewed" entry, delete it from
the given tab, and assert the Recents entry disappears promptly
rather than lingering.

This was prompted by a video-capture run that appeared to show a
stale Recents entry surviving 15+ seconds after a Mine-tab dashboard
delete. A from-scratch repro (fresh SQLite DB, fresh backend/webpack,
no leftover state) could not reproduce it: the entry disappeared
immediately, across dashboards and charts, on every tab. These tests
pin that correct behavior down as a regression guard, since nothing
previously covered it end-to-end in a real browser.

Extends HomePage with helpers for the Dashboards/Charts card lists
(tab switching, card lookup scoped to the right panel, kebab-menu
delete) and the Recents panel, reused across all six tests.

Co-Authored-By: Evan Rusackas <evan@rusackas.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@rusackas

Copy link
Copy Markdown
Member Author

Quick update for anyone waiting on the updated demo video.

While putting together a Playwright recording covering all three tabs (Favorite/Mine/All) for both Dashboards and Charts, one run appeared to show a dashboard's Recents entry surviving 15+ seconds after deleting it from the Mine tab - which would have meant this fix doesn't actually work in that case. That capture environment had accumulated a lot of cruft (orphaned processes, a possibly-stale webpack bundle), so before touching any code I ran a from-scratch repro instead: fresh SQLite DB, fresh migrations, fresh backend + webpack dev server, nothing left over from prior runs. It could not reproduce the staleness - the Recents entry disappeared immediately on every tab, for both dashboards and charts.

That matches what the code shows: LogDAO.get_recent_activity correctly excludes soft-deleted items, the /recent_activity/ response carries no caching headers, and onActivityRefresh fires regardless of which tab triggered the delete. So the original capture's staleness looks like an artifact of that environment, not a real bug.

To make sure this stays pinned down, I added playwright/tests/home/recent-activity-refresh.spec.ts, covering all six combinations of {Favorite, Mine, All} x {Dashboards, Charts}. All six pass cleanly against a clean environment.

Still finishing up a cleaner demo video (readable fixture names instead of the long IDs in the current one) - will post it here once it's ready.

@rusackas
rusackas marked this pull request as draft October 31, 2026 01:16

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants