Skip to content

Commit

Permalink
useSelect: keep lastMapResult and lastMapSelect always in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Mar 13, 2023
1 parent 8ad89a9 commit 490e315
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/data/src/components/use-select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function Store( registry, suspense ) {
if ( ! isShallowEqual( lastMapResult, mapResult ) ) {
lastMapResult = mapResult;
}
lastMapSelect = mapSelect;
lastMapResultValid = true;
}

Expand All @@ -165,7 +166,6 @@ function Store( registry, suspense ) {
updateValue();

lastIsAsync = isAsync;
lastMapSelect = mapSelect;

// Return a pair of functions that can be passed to `useSyncExternalStore`.
return { subscribe: subscriber.subscribe, getValue };
Expand Down

0 comments on commit 490e315

Please sign in to comment.