sadpandajoe opened a new pull request, #44272:
URL: https://github.com/apache/superset/pull/44272

   ### Summary
   
   A customer-reported issue: when switching between dashboard tabs, a chart 
that starts loading for
   the first time (or is otherwise not part of an in-flight background 
auto-refresh batch) never
   showed its loading spinner, leaving the tile blank until the data arrived.
   
   `AutoRefreshContext.isAutoRefreshing` was a single dashboard-wide boolean, 
set while *any* silent
   auto-refresh cycle was in flight. Every chart on the dashboard read this 
same global flag to decide
   whether to suppress its own loading spinner — including charts that had 
nothing to do with that
   refresh cycle, such as one mounting for the first time when a user switches 
into a tab.
   
   ### Fix
   
   Scope the spinner suppression to the specific chart IDs actually included in 
the in-flight refresh
   batch, instead of the whole dashboard:
   
   - `AutoRefreshContext` now also tracks `autoRefreshingChartIds` alongside 
the existing
     `isAutoRefreshing` boolean (left untouched, since other consumers — the 
tab-visibility catch-up
     refresh and the filters-bar indicator — legitimately need the 
dashboard-wide signal for their own
     purposes).
   - Added `useIsChartAutoRefreshing(chartId)`, which checks membership in that 
batch.
   - The dashboard chart tile now calls `useIsChartAutoRefreshing(props.id)` 
instead of the global
     `useIsAutoRefreshing()` when deciding whether to suppress its spinner.
   - `useHeaderAutoRefresh` passes the actual filtered chart-id batch into 
`startAutoRefresh`.
   
   ### Testing
   
   - Added a failing test first, reproducing the bug: a chart outside the 
refresh batch had its
     spinner suppressed. Confirmed it failed against the unmodified code before 
implementing the fix.
   - Added regression coverage in `AutoRefreshContext.test.tsx`, 
`useHeaderAutoRefresh.test.tsx`, and
     `Chart.test.tsx` covering batch scoping, the empty-batch default, and 
clearing on refresh end.
   - Full suite for the touched area (`AutoRefreshContext`, `Chart` (dashboard 
grid), `Tab`,
     `FiltersBadge`, `useHeaderAutoRefresh`) passes; lint and typecheck are 
clean on all touched files.
   
   ## Before
   
   ![Before: chart tiles sit blank with no spinner while still 
loading](https://gist.githubusercontent.com/sadpandajoe/91b2ebdb58c2ab687de9ab1d67d076ae/raw/8dee46a0f445c8b35e24850863a2e4bb5d6f7a3e/before.png)
   
   ## After
   
   ![After: the loading spinner renders 
normally](https://gist.githubusercontent.com/sadpandajoe/91b2ebdb58c2ab687de9ab1d67d076ae/raw/8dee46a0f445c8b35e24850863a2e4bb5d6f7a3e/after.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to