Skip to content

fix(dashboards): Invalidate dashboards list and grid on delete#115354

Draft
gggritso wants to merge 3 commits into
masterfrom
georgegritsouk/dain-1577-deleted-dashboard-still-visible-in-card-view-after-deleting
Draft

fix(dashboards): Invalidate dashboards list and grid on delete#115354
gggritso wants to merge 3 commits into
masterfrom
georgegritsouk/dain-1577-deleted-dashboard-still-visible-in-card-view-after-deleting

Conversation

@gggritso
Copy link
Copy Markdown
Member

@gggritso gggritso commented May 12, 2026

In DAIN-1577, deleting a dashboards from one view (e.g., "Card") doesn't remove that dashboards from the other view ("Table"). This happens because right now deletion calls refetch. refetch only refetches the current hook instance, which means it only refetches the current view. Instead, I'm setting it to invalidate the query. This updates both views.

As an aside, ideally instead of having this kind of logic in callbacks from a component, we'd just invalidate the cache at the moment of mutation (e.g., in action creators) but I wanted to keep the change small for now.

…favorite

Previously, deleting or favoriting a dashboard only invalidated the
starred dashboards query. Since Card and Table views use different
query params (per_page, sort), switching views after a delete would
still show the stale cached data. Use the URL prefix from
dashboardsApiOptions for query invalidation so all dashboard list
queries are covered.

Also migrates useInvalidateStarredDashboards to use dashboardsApiOptions
directly and removes the now-unused getStarredDashboardsQueryKey helper.

Refs DAIN-1577
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 12, 2026

DAIN-1577

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.49%

@gggritso gggritso changed the title fix(dashboards): Invalidate all dashboard list queries on delete and favorite fix(dashboards): Invalidate dashboards list and grid on delete May 12, 2026
…favorite

Previously, the manage page called refetchDashboards() after a delete
or duplicate, which only refetched the current view's query. Since Card
and Table views use different query params (per_page, sort), switching
views after a delete would still show stale cached data.

Replace refetch with queryClient.invalidateQueries using
dashboardsApiOptions, which invalidates all dashboard list queries
regardless of their query params.

Refs DAIN-1577
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The cache invalidation fix only needs to live in the manage page's
onDashboardsChange handler. Revert the action creator and starred
dashboard hook changes that are no longer part of the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant