Fix streams overview metric columns not populating on initial load - #26824
Open
laura-b-g wants to merge 6 commits into
Open
Fix streams overview metric columns not populating on initial load#26824laura-b-g wants to merge 6 commits into
laura-b-g wants to merge 6 commits into
Conversation
…pdate without reload The StreamsOverview component called useUserLayoutPreferences with an empty string for the default view variant, while PaginatedEntityTable (via useTableLayout) used undefined. Both map to the same URL but produce separate react-query cache entries. When the user added a metric column, useUpdateUserLayoutPreferences only refetched the undefined-keyed entry (used by the table). The empty-string entry in StreamsOverview had a 1-hour staleTime and was never invalidated, so requestedFields stayed stale and the metrics query never fetched the new field — cells remained empty until a full page reload. Fix: convert the empty-string default-view variant to undefined before passing it to useUserLayoutPreferences, so both callers share the same cache entry and both get the updated preferences after a column change. Closes #26724
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
Metric columns in the streams overview (message count, processing time, etc.) don't populate after being added to the view — cells stay empty until the page is reloaded.
Motivation and Context
`StreamsOverview` was calling `useUserLayoutPreferences('streams', '')` (empty string for the default view), while `PaginatedEntityTable` (via `useTableLayout`) calls `useUserLayoutPreferences('streams', undefined)`. Both map to the same backend URL, but they land in separate react-query cache entries because `''` and `undefined` are distinct query keys.
When the user adds a metric column, `useUpdateUserLayoutPreferences` only refetches the `undefined`-keyed entry. The `''`-keyed entry has a 1-hour `staleTime` and is never invalidated. So the table renders the new column (from the refreshed `undefined` entry), but `requestedFields` in `StreamsOverview` is computed from the stale `''` entry — the metric field is never requested, and the cells stay blank. Only a full page reload (clearing both cache entries) makes it work.
Fix: convert the empty-string default-view variant to `undefined` before passing it to `useUserLayoutPreferences`, so both callers share the same cache entry and both receive updated preferences after any column change.
How can this be tested?
Types of changes
Closes #26724