@playlive/react-query
    Preparing search index...

    Function useAlertsQueue

    • Alert-queue display processor. Pulls donations off an external queue via UseAlertsQueueParams.getMostRecentDonation / UseAlertsQueueParams.consumeDonation, gates them on UseAlertsQueueParams.minDonation, and drives the display timing via a self-scheduling setTimeout chain (no setInterval, no shared timers).

      behavior:

      • Every tick either shows the next eligible donation (for the DonorLevel duration derived from donation.amount.value) or waits idleCheckIntervalMs before checking again.
      • Donations below minDonation are consumed but never surfaced — keeps the queue clean without emitting an alert.
      • A short interAlertGapMs gap is inserted after each alert to give the UI a moment to un-mount before the next alert appears.

      The hook keeps getMostRecentDonation / consumeDonation / minDonation in refs so it doesn't tear down the timing loop on every render — callers can pass fresh closures without stampeding.

      Parameters

      Returns UseAlertsQueueResult

      const queue = useDonationsRewardsContext();
      const { donation } = useAlertsQueue({
      minDonation: 5,
      getMostRecentDonation: queue.getMostRecentDonation,
      consumeDonation: queue.consumeDonation,
      });
      return donation ? <AlertOverlay donation={donation} /> : null;