@playlive/realtime-pipeline
    Preparing search index...

    Function mergePolls

    • Merges two poll record maps by campaign ID, then by poll ID within each campaign. Incoming polls overwrite existing polls with the same ID so vote-count updates are always reflected, while polls absent from the incoming batch are preserved rather than silently dropped.

      Parameters

      • existing: Record<string, TiltifyPoll[]>

        Current per-campaign poll map.

      • incoming: Record<string, TiltifyPoll[]> | undefined

        Fresh per-campaign poll map (may be undefined).

      • authoritative: boolean = false

        When true, incoming is the complete poll list for every campaign it names; those campaigns are replaced wholesale so deleted polls disappear. Defaults to false.

      Returns Record<string, TiltifyPoll[]>

      Merged map with polls preserved across ticks.

      const polls = mergePolls(store.polls, tick.data.polls);