From 490e315e99b2417ef1d41b9d65dc84c26225202a Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Mon, 13 Mar 2023 09:45:22 +0100 Subject: [PATCH] useSelect: keep lastMapResult and lastMapSelect always in sync --- packages/data/src/components/use-select/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/data/src/components/use-select/index.js b/packages/data/src/components/use-select/index.js index fa7ffdaebb21b..e1082b50a5465 100644 --- a/packages/data/src/components/use-select/index.js +++ b/packages/data/src/components/use-select/index.js @@ -145,6 +145,7 @@ function Store( registry, suspense ) { if ( ! isShallowEqual( lastMapResult, mapResult ) ) { lastMapResult = mapResult; } + lastMapSelect = mapSelect; lastMapResultValid = true; } @@ -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 };