Skip to content

Commit f013206

Browse files
committed
move setting memoizedSnapshot
1 parent a4bc8ae commit f013206

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/use-sync-external-store/src/useSyncExternalStoreExtra.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export function useSyncExternalStoreExtra<Snapshot, Selection>(
7676
}
7777

7878
// The snapshot has changed, so we need to compute a new selection.
79-
memoizedSnapshot = nextSnapshot;
8079
const nextSelection = selector(nextSnapshot);
8180

8281
// If a custom isEqual function is provided, use that to check if the data
@@ -87,6 +86,7 @@ export function useSyncExternalStoreExtra<Snapshot, Selection>(
8786
return prevSelection;
8887
}
8988

89+
memoizedSnapshot = nextSnapshot;
9090
memoizedSelection = nextSelection;
9191
return nextSelection;
9292
};

0 commit comments

Comments
 (0)