File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -534,8 +534,11 @@ class OnyxCache {
534534
535535 const snapshot = this . collectionSnapshots . get ( collectionKey ) ;
536536 if ( utils . isEmptyObject ( snapshot ) ) {
537- // If we know we have storage keys loaded, return a stable empty reference
538- // to avoid new {} allocations that break useSyncExternalStore === equality.
537+ // We check storageKeys.size (not collection-specific keys) to distinguish
538+ // "init complete, this collection is genuinely empty" from "init not done yet."
539+ // During init, setAllKeys loads ALL keys at once — so if any key exists,
540+ // the full storage picture is loaded and an empty collection is truly empty.
541+ // Returning undefined before init prevents subscribers from seeing a false empty state.
539542 if ( this . storageKeys . size > 0 ) {
540543 return FROZEN_EMPTY_COLLECTION ;
541544 }
You can’t perform that action at this time.
0 commit comments