console: Keep freshness data on screen while a new range loads
**Problem** Changing the time range or cluster on Monitoring > Freshness blanks the page to a spinner before the new data arrives. The previous data was still valid and is about to be replaced by something similar, so the blank is pure flicker. It is most noticeable at wider ranges, where the query takes longest. The same applies to Cluster Detail > Overview, which uses the same hook. **Cause** `useClusterFreshness` ([`console/src/platform/clusters/queries.ts`](<https://github.com/MaterializeInc/materialize/blob/main/console/src/platform/clusters/queries.ts>)) uses `useSuspenseQuery`, which suspends whenever its query key changes. The key includes the lookback and the object IDs, so any range change unmounts the content and shows the Suspense fallback. **Change** Move the hook to `useQuery` with `placeholderData: keepPreviousData`. The 60s `staleTime` and `refetchInterval` are already in place from #39340. **Why it was not done in #39340** It changes the hook's contract rather than its configuration: * `data` becomes `T | undefined`, so both call sites stop compiling. Both currently destructure straight through `data` into its fields, which only works because `useSuspenseQuery` guarantees it is present. * `Suspense` no longer fires, so both components need an explicit loading branch, and their existing `<Suspense>` wrappers become dead code. * One of those call sites is Cluster Detail, which was otherwise untouched by that PR. **Call sites** * `console/src/platform/freshness/FreshnessPage.tsx` — `FreshnessContent` * `console/src/platform/clusters/ClusterOverview/ClusterFreshness.tsx` — `FreshnessGraphWrapper` **Acceptance criteria** * Changing the range on Freshness keeps the previous graph and tables visible until the new data lands * Same on Cluster Detail > Overview * First load still shows a loading state, since there is no previous data to keep * A failed query still surfaces through `AppErrorBoundary`, and still clears when the cluster or range changes (the boundary key from #39340 must be preserved) **Reference:** [review comment on #39340](<https://github.com/MaterializeInc/materialize/pull/39340#discussion_r4147961844>)
No prototypes yet. Click "Generate Fix" to create one.