diff --git a/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js b/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js index aa4957b534753..f4a1885aec5b9 100644 --- a/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js +++ b/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js @@ -76,6 +76,7 @@ export function useSyncExternalStoreExtra( } // The snapshot has changed, so we need to compute a new selection. + memoizedSnapshot = nextSnapshot; const nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data @@ -86,7 +87,6 @@ export function useSyncExternalStoreExtra( return prevSelection; } - memoizedSnapshot = nextSnapshot; memoizedSelection = nextSelection; return nextSelection; };