fix(dashboards): Invalidate dashboards list and grid on delete#115354
Merged
gggritso merged 3 commits intoMay 12, 2026
Merged
Conversation
…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>
Contributor
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.49% |
…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.
nikkikapadia
approved these changes
May 12, 2026
nikkikapadia
pushed a commit
that referenced
this pull request
May 12, 2026
In DAIN-1577, deleting a dashboards from _one_ view (e.g., "Card")
doesn't remove that dashboard 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.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In DAIN-1577, deleting a dashboards from one view (e.g., "Card") doesn't remove that dashboard from the other view ("Table"). This happens because right now deletion calls
refetch.refetchonly 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.