Skip to content

fix(dashboards): Starred dashboards not changing in navbar #90338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 28, 2025

Conversation

nikkikapadia
Copy link
Member

@nikkikapadia nikkikapadia commented Apr 24, 2025

Before, starring a dashboard on the manage dashboards page would show changes in the nav bar but if it was favourited anywhere else it would not. I've moved the logic to clear the api query cache to the updateDashboardFavorite function so that the cache is cleared every time a favourite dashboard is updated. As long as this function is being used to update the favourites, the navbar will show the changes. (This function is being used to update favourites in all places afaik)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 24, 2025
@nikkikapadia nikkikapadia marked this pull request as ready for review April 25, 2025 13:19
@nikkikapadia nikkikapadia requested a review from a team as a code owner April 25, 2025 13:19
Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

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

👍🏻 LGTM!

I think this could be followed with a small refactor:

  • updateDashboardFavorite could use the useMutation hook from TanStack Query (there are a bunch of examples of this floating around the codebase) which is a more up-to-date way of doing this kind of thing
  • a successful mutation shouldn't invalidate the whole cache, I think you can use the setApiQueryData helper to update the cache. This way the page won't need to do a full re-fetch of the dashboard data

If neither of those suggestions actually makes sense you can ignore.

@nikkikapadia nikkikapadia merged commit baa67b4 into master Apr 28, 2025
46 checks passed
@nikkikapadia nikkikapadia deleted the nikki/fix/starred-dashboard-from-dashboard branch April 28, 2025 15:34
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.

2 participants