diff --git a/src/throttledStore.tsx b/src/throttledStore.tsx index 40db6d7..22b1c85 100644 --- a/src/throttledStore.tsx +++ b/src/throttledStore.tsx @@ -311,15 +311,9 @@ export const createObservable = ( name: uniqueName } const observersSlot = shell.declareSlot(subscribersSlotKey) - let cachedSelector: TSelector | undefined - const getOrCreateCachedSelector = (): TSelector => { - if (cachedSelector) { - return cachedSelector - } - const newSelector = selectorFactory(shell.getStore().getState()) - cachedSelector = newSelector - return newSelector + const createSelector = (): TSelector => { + return selectorFactory(shell.getStore().getState()) } return { @@ -330,10 +324,9 @@ export const createObservable = ( } }, notify() { - cachedSelector = undefined - const newSelector = getOrCreateCachedSelector() + const newSelector = createSelector() invokeSlotCallbacks(observersSlot, newSelector) }, - current: getOrCreateCachedSelector + current: createSelector } }