web / lib/hooks/use-loading-phase
lib/hooks/use-loading-phase
Hook that tracks whether data has loaded at least once.
Provides isInitialLoad and isUpdating flags to distinguish first-load
skeletons from background-refresh spinners. Used by chart wrappers and
explorer components that combine multiple query loading states.
Interfaces
LoadingPhase
Properties
isInitialLoad
isInitialLoad:
boolean
True when loading for the first time (nothing rendered yet)
isUpdating
isUpdating:
boolean
True when loading but data was already shown at least once
Functions
useLoadingPhase()
useLoadingPhase(
isLoading):LoadingPhase
Track loading phase for a single isLoading boolean.
Parameters
isLoading
boolean
Whether the data source is currently loading
Returns
Loading phase flags
Example
const isLoading = eventsLoading || clustersLoading;
const { isInitialLoad, isUpdating } = useLoadingPhase(isLoading);Last updated on