Skip to content

Commit

Permalink
Merge pull request #3 from official-carledwardfp/main
Browse files Browse the repository at this point in the history
fixes server-rendered getServerSnapshot requirement
  • Loading branch information
jherr authored Oct 23, 2022
2 parents e4b46fd + 9d26313 commit 9d14bb1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fast-context-generic/src/createFastContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ export default function createFastContext<Store>(initialState: Store) {
throw new Error("Store not found");
}

const state = useSyncExternalStore(store.subscribe, () =>
selector(store.get())
const state = useSyncExternalStore(
store.subscribe,
() => selector(store.get()),
() => selector(initialState),
);

return [state, store.set];
Expand Down

0 comments on commit 9d14bb1

Please sign in to comment.