fix: update default dashboard on landing page when changed from hub#343
Draft
OlhaTmlk wants to merge 1 commit into
Draft
fix: update default dashboard on landing page when changed from hub#343OlhaTmlk wants to merge 1 commit into
OlhaTmlk wants to merge 1 commit into
Conversation
…add alert in hub when delete default
Contributor
Author
|
/retest |
1 similar comment
Contributor
Author
|
/retest |
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.
Description
Fixes stale dashboard data on the start page when navigating from the Dashboard Hub or generic dashboard pages. Previously, the start page cached the homepage dashboard in jotai atoms and never re-fetched, even after the user changed their homepage or edited the homepage dashboard's layout on another page.
Changes:
dashboardsAtom.ts: InvalidatestemplateIdAtom(resets to -1) when setting a new homepage (setDefaultDashboardAtom), creating/duplicating with "set as homepage" enabled, or deleting the currenthomepage dashboard.
useDashboardTemplate.ts: InvalidatestemplateIdAtomafter saving template changes on the generic dashboard page, but only if the edited dashboard is the homepage (dashboard.default).Invalidation runs after the debounced API call completes to avoid a race condition where the start page re-fetches before the patch lands.
DashboardTable.tsx: Shows an inline warning alert when no dashboard is set as homepage (e.g., after deleting the homepage dashboard).How it works: The start page (
useDashboardConfig) only fetches whentemplateIdAtom < 0. Mutations that affect the homepage reset it to -1, so the next time the start page mounts, it fetches fresh data from the API.RHCLOUD48080
Screenshots