Repository navigation
fix(app): pulse number, bar and pie tiles while a dashboard refreshes #3211
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
Changes from all commits
f4ceb2e
175d8dd
f94a99c
951da90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| fix: show that number, bar and pie tiles are refreshing | ||
|
|
||
| During a dashboard refresh these tiles kept the previous result on screen with | ||
| no sign that new data was loading, so stale values looked current. They now | ||
| pulse while the refetch runs, like line and stacked-bar time charts already do. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,14 +56,12 @@ export function useCategoricalChart({ | |
| const { data: mvOptimizationData } = | ||
| useMVOptimizationExplanation(builderQueriedConfig); | ||
|
|
||
| const { data, isLoading, isError, error } = useQueriedChartConfig( | ||
| queriedConfig, | ||
| { | ||
| const { data, isLoading, isError, error, isPlaceholderData } = | ||
| useQueriedChartConfig(queriedConfig, { | ||
| placeholderData: (prev: any) => prev, | ||
| queryKey: [queryKeyPrefix, queriedConfig], | ||
| enabled, | ||
| }, | ||
| ); | ||
| }); | ||
|
|
||
| const toolbarItems = useMemo(() => { | ||
| const allToolbarItems: React.ReactNode[] = []; | ||
|
|
@@ -130,6 +128,8 @@ export function useCategoricalChart({ | |
| toolbarItems, | ||
| data, | ||
| isLoading, | ||
| // True while a refetch (e.g. dashboard refresh) shows the previous result | ||
| isPlaceholderData, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 minor — Two different pulse conditions: the empty state checks only Work out the refresh flag once in Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair: the empty state should match the chart's |
||
| isError, | ||
| error, | ||
| chartData, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 minor —
isLoading ||can never be true in this branch, so it does nothingisLoadingis only true when the query is pending with no data, and that case is already caught by theisLoading && !databranch above. If this branch has data while pending, the data is the placeholder, soisPlaceholderDatais already true. UseisPlaceholderDataalone here and in the pieFlex(DBPieChart.tsx:128) so it matches the empty-state branches, which already check onlyisPlaceholderData.Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept on purpose:
useQueriedChartConfig'sisLoadingalso covers the MV-optimization check, so it can be true while a value is on screen. f94a99c adds a test for that case, and it fails withoutisLoading ||.