From f01320689cebfcbc4f3a53208f879ed4a8d6613d Mon Sep 17 00:00:00 2001 From: daishi Date: Mon, 4 Oct 2021 11:17:38 +0900 Subject: [PATCH] move setting memoizedSnapshot --- .../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; };