From f3eecd8bcac1b3a117c198ff441e97934b405b40 Mon Sep 17 00:00:00 2001 From: daishi Date: Mon, 4 Oct 2021 16:20:13 +0900 Subject: [PATCH] Revert "Revert "move setting memoizedSnapshot"" This reverts commit cb43c4fdc6b0dcab3480f27d6fbbb3137dbc47bb. --- .../use-sync-external-store/src/useSyncExternalStoreExtra.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js b/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js index f4a1885aec5b9..aa4957b534753 100644 --- a/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js +++ b/packages/use-sync-external-store/src/useSyncExternalStoreExtra.js @@ -76,7 +76,6 @@ 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 @@ -87,6 +86,7 @@ export function useSyncExternalStoreExtra( return prevSelection; } + memoizedSnapshot = nextSnapshot; memoizedSelection = nextSelection; return nextSelection; };