Skip to content

Commit

Permalink
Use isCollectionKey() instead of checking "_"
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioh8010 committed Sep 17, 2024
1 parent 8174e61 commit 2acab1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/OnyxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ function subscribeToKey<TKey extends OnyxKey>(connectOptions: ConnectOptions<TKe
// Performance improvement
// If the mapping is connected to an onyx key that is not a collection
// we can skip the call to getAllKeys() and return an array with a single item
if (Boolean(mapping.key) && typeof mapping.key === 'string' && !mapping.key.endsWith('_') && cache.getAllKeys().has(mapping.key)) {
if (Boolean(mapping.key) && typeof mapping.key === 'string' && !isCollectionKey(mapping.key) && cache.getAllKeys().has(mapping.key)) {
return new Set([mapping.key]);
}
return getAllKeys();
Expand Down

0 comments on commit 2acab1d

Please sign in to comment.