Skip to content

Commit

Permalink
Revert "Revert "move setting memoizedSnapshot""
Browse files Browse the repository at this point in the history
This reverts commit cb43c4f.
  • Loading branch information
dai-shi committed Oct 4, 2021
1 parent 3fa565a commit f3eecd8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export function useSyncExternalStoreExtra<Snapshot, Selection>(
}

// 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
Expand All @@ -87,6 +86,7 @@ export function useSyncExternalStoreExtra<Snapshot, Selection>(
return prevSelection;
}

memoizedSnapshot = nextSnapshot;
memoizedSelection = nextSelection;
return nextSelection;
};
Expand Down

0 comments on commit f3eecd8

Please sign in to comment.