Dashboard tiles other than line/bar time charts show no sign they are refreshing
What happened?
When a dashboard refreshes, most tiles keep showing the old result with no loading sign until the new data arrives. Only line and stacked-bar time charts pulse while they refetch. Number, table, bar and pie tiles look finished the whole time. You can't tell stale values from fresh ones, and with live refresh on you may act on numbers that are minutes old.
Expected: every tile shows that it is refreshing (for example the same effect-pulse the time charts use) while it keeps the previous result on screen.
Steps to reproduce
- Create a dashboard on the default
otel_logssource with four tiles: a line time chart, a Number tile (for examplecount()), a Table tile grouped byServiceName, and a Pie or Bar tile grouped bySeverityText. - Pick a time range large enough that each query takes a second or more. You can also throttle the network in dev tools.
- Click "Refresh dashboard", or turn on live refresh.
- Watch the tiles while the queries run. The time chart pulses. The number, table, bar and pie tiles keep the old values with no sign of loading, then switch to the new values.
How are you running HyperDX?
Found by reading the code on main at 6767349. It affects any deployment that uses the app's dashboards.
Where does it show up?
UI, on the dashboard page, in any browser.
Root cause
A refresh moves the time range forward, so each tile runs with a new query key (useDashboardRefresh.tsx#L27-L39). The tiles set placeholderData: prev => prev. With react-query v5 (package.json#L53, ^5.56.2), a query that shows placeholder data is in success state. So isLoading stays false for the whole refetch. Only isPlaceholderData and isFetching are true.
- Time charts handle this correctly. DBTimeChart.tsx#L487-L489 reads
isPlaceholderData, and DBTimeChart.tsx#L542-L547 adds it toisLoadingOrPlaceholder. That value driveseffect-pulseat HDXMultiSeriesTimeChart.tsx#L1627. - Number tile: DBNumberChart.tsx#L238-L243 uses placeholder data. DBNumberChart.tsx#L377 shows a loader only when
isLoading && !data, so a refresh shows no sign at all. - Table tile: DBTableChart.tsx#L291 uses the same
isLoading && !datacheck. - Bar and pie tiles: CategoricalChart.tsx#L59-L66 uses placeholder data but returns only
isLoading(L128-L137). DBBarChart.tsx#L101 and DBPieChart.tsx#L128 pulse onisLoading, which isfalseduring a refresh. - useChartConfig.tsx#L448-L451 passes
isPlaceholderDataandisFetchingthrough unchanged, so each tile has to handle them itself. Most don't.
Suggested fix
- Add a "refreshing" flag (
isPlaceholderData || isFetching) and use it in every tile, next to the existingisLoading && !datafirst-load check. - Return the flag from
useCategoricalChart, and make bar and pie pulse on it. - Apply the same
effect-pulse(or a small spinner in the tile header) to the number and table tiles. - One option is to return an
isRefreshingfield fromuseQueriedChartConfig, so new tile types get it without extra work.
Logs
None. Nothing fails; the UI just gives no feedback.
Source: hyperdxio/hyperdx