diff --git a/src/Squawk.ts b/src/Squawk.ts index 9eefea5..8743d6f 100644 --- a/src/Squawk.ts +++ b/src/Squawk.ts @@ -271,7 +271,10 @@ export default function createStore(initialState: Required, useReduxDevToo } // Invoke all unique subscribers with the new pending states - pendingSubscribersInternal.forEach((subscriber) => subscriber(pendingState.get())); + if (pendingSubscribersInternal.size > 0) { + const currentPendingState = pendingState.get(); + pendingSubscribersInternal.forEach((subscriber) => subscriber(currentPendingState)); + } }, /** Sets up a subscription for a single global state context */ subscribe(context: TContext, callback: Callback): () => void {