Skip to content

fix: update default dashboard on landing page when changed from hub#343

Draft
OlhaTmlk wants to merge 1 commit into
RedHatInsights:masterfrom
OlhaTmlk:fix-layout
Draft

fix: update default dashboard on landing page when changed from hub#343
OlhaTmlk wants to merge 1 commit into
RedHatInsights:masterfrom
OlhaTmlk:fix-layout

Conversation

@OlhaTmlk
Copy link
Copy Markdown
Contributor

@OlhaTmlk OlhaTmlk commented Jun 1, 2026

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: Invalidates templateIdAtom (resets to -1) when setting a new homepage (setDefaultDashboardAtom), creating/duplicating with "set as homepage" enabled, or deleting the current
    homepage dashboard.
  • useDashboardTemplate.ts: Invalidates templateIdAtom after 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 when templateIdAtom < 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

Screenshot 2026-06-01 at 12 23 35

@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

OlhaTmlk commented Jun 1, 2026

/retest

1 similar comment
@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

OlhaTmlk commented Jun 2, 2026

/retest

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant