Subscribe to leaderboard-entry updates and invoke handler for
every new or replaced entry in store.leaderboardEntries.
Fires whenever the updateLeaderboard WS push (or an equivalent
_updateLeaderboardForCampaign action) replaces the cached top-N
for a campaign — exactly the event that invalidates any cached
REST snapshot of the same leaderboard (e.g. the overlay's
/leaderboard-with-exclusions/{id} query). Consumers usually pair
this with refetch() on the REST query so operators see donation-
driven ranking shifts within one WS tick instead of waiting for the
next safety-net poll.
Mirrors useOnLeaderboardExclusionsChange: the handler is
stashed in a ref so this hook subscribes exactly once (idempotent
across re-renders). The optional campaignIDs filter is compared
each fire — empty / undefined means "all campaigns".
Fires on the leading edge of a change: entry lists already present
on the store at mount time are treated as baseline and do NOT fire
the handler. Every subsequent push does. Reference identity of the
per-campaign array is guaranteed fresh by the mutator (see
_updateLeaderboardForCampaign in @playlive/realtime-pipeline)
so !== is enough.
Soft-fails when no <RealtimePipelineProvider> is mounted — lets
consumers wire this into overlay hooks that may render outside a
pipeline provider (tests, demo mode) without a hard throw. Selector
hooks in this module continue to require a provider.
Subscribe to leaderboard-entry updates and invoke
handlerfor every new or replaced entry instore.leaderboardEntries.Fires whenever the
updateLeaderboardWS push (or an equivalent_updateLeaderboardForCampaignaction) replaces the cached top-N for a campaign — exactly the event that invalidates any cached REST snapshot of the same leaderboard (e.g. the overlay's/leaderboard-with-exclusions/{id}query). Consumers usually pair this withrefetch()on the REST query so operators see donation- driven ranking shifts within one WS tick instead of waiting for the next safety-net poll.Mirrors useOnLeaderboardExclusionsChange: the handler is stashed in a ref so this hook subscribes exactly once (idempotent across re-renders). The optional
campaignIDsfilter is compared each fire — empty / undefined means "all campaigns".Fires on the leading edge of a change: entry lists already present on the store at mount time are treated as baseline and do NOT fire the handler. Every subsequent push does. Reference identity of the per-campaign array is guaranteed fresh by the mutator (see
_updateLeaderboardForCampaignin@playlive/realtime-pipeline) so!==is enough.Soft-fails when no
<RealtimePipelineProvider>is mounted — lets consumers wire this into overlay hooks that may render outside a pipeline provider (tests, demo mode) without a hard throw. Selector hooks in this module continue to require a provider.