Skip to content

Commit

Permalink
move setting memoizedSnapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Oct 4, 2021
1 parent a4bc8ae commit f013206
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 f013206

Please sign in to comment.