@@ -23,16 +23,20 @@ export const sharedWorkerStore = createStore<SharedWorkerStoreState & SharedWork
2323 // Actions
2424 registerSubscription : ( subscription ) => {
2525 const state = get ( )
26-
26+
2727 // Check if we already have an equivalent subscription
2828 const existingSubscriptions = Array . from ( state . subscriptions . values ( ) )
29- const equivalentSubscription = existingSubscriptions . find ( existing =>
30- areSubscriptionsEquivalent ( existing , subscription )
29+ const equivalentSubscription = existingSubscriptions . find ( ( existing ) =>
30+ areSubscriptionsEquivalent ( existing , subscription ) ,
3131 )
3232
3333 if ( equivalentSubscription ) {
3434 // Return the existing subscription ID instead of creating a new one
35- console . log ( '[SharedWorkerStore] Found equivalent subscription, reusing:' , equivalentSubscription . subscriptionId )
35+ // eslint-disable-next-line no-console
36+ console . log (
37+ '[SharedWorkerStore] Found equivalent subscription, reusing:' ,
38+ equivalentSubscription . subscriptionId ,
39+ )
3640 return equivalentSubscription . subscriptionId
3741 }
3842
@@ -43,15 +47,16 @@ export const sharedWorkerStore = createStore<SharedWorkerStoreState & SharedWork
4347 lastUpdate : Date . now ( ) ,
4448 }
4549
46- set ( ( state ) => {
47- const newSubscriptions = new Map ( state . subscriptions )
50+ set ( ( currentState ) => {
51+ const newSubscriptions = new Map ( currentState . subscriptions )
4852 newSubscriptions . set ( subscription . subscriptionId , activeSubscription )
4953
5054 return {
5155 subscriptions : newSubscriptions ,
5256 }
5357 } )
5458
59+ // eslint-disable-next-line no-console
5560 console . log ( '[SharedWorkerStore] Created new subscription:' , subscription . subscriptionId )
5661 return subscription . subscriptionId
5762 } ,
0 commit comments