Skip to content

Commit

Permalink
warn for re-subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
sashankaryal committed Sep 18, 2024
1 parent bf3479b commit a3c1404
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/packages/playback/src/lib/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ export const addSubscriberAtom = atom(
subscription,
}: { name: TimelineName; subscription: SequenceTimelineSubscription }
) => {
// warn if subscription with this id already exists
if (get(_subscribers(name)).has(subscription.id)) {
console.warn(
`Subscription with ${subscription.id} already exists for timeline ${name}. Replacing old subscription. Make sure this is an intentional behavior.`
);
}

const bufferManager = get(_dataLoadedBuffers(name));

set(_subscribers(name), (prev) => {
Expand Down

0 comments on commit a3c1404

Please sign in to comment.