@@ -477,7 +477,7 @@ function isCollectionMemberKey<TCollectionKey extends CollectionKeyBase>(collect
477477function isCollectionMember ( key : OnyxKey ) : boolean {
478478 const collectionKey = getCollectionKey ( key ) ;
479479 // If the key is longer than the collection key, it's a collection member
480- return collectionKey !== null && key . length > collectionKey . length ;
480+ return ! ! collectionKey && key . length > collectionKey . length ;
481481}
482482
483483/**
@@ -499,7 +499,7 @@ function isCollectionMember(key: OnyxKey): boolean {
499499 */
500500function isRamOnlyKey ( key : OnyxKey ) : boolean {
501501 const collectionKey = getCollectionKey ( key ) ;
502- if ( collectionKey !== null ) {
502+ if ( collectionKey ) {
503503 return cache . isRamOnlyKey ( collectionKey ) ;
504504 }
505505
@@ -523,7 +523,7 @@ function splitCollectionMemberKey<TKey extends CollectionKey, CollectionKeyType
523523
524524 if ( ! collectionKey ) {
525525 const resolvedKey = getCollectionKey ( key ) ;
526- if ( resolvedKey === null ) {
526+ if ( ! resolvedKey ) {
527527 throw new Error ( `Invalid '${ key } ' key provided, only collection keys are allowed.` ) ;
528528 }
529529 // eslint-disable-next-line no-param-reassign
@@ -551,9 +551,9 @@ function isKeyMatch(configKey: OnyxKey, key: OnyxKey): boolean {
551551 * - `getCollectionKey("sharedNVP_user_-1_something")` would return "sharedNVP_user_"
552552 *
553553 * @param key - The collection key to process.
554- * @returns The plain collection key or null if the key is not a collection one.
554+ * @returns The plain collection key or undefined if the key is not a collection one.
555555 */
556- function getCollectionKey ( key : CollectionKey ) : string | null {
556+ function getCollectionKey ( key : CollectionKey ) : string | undefined {
557557 // Start by finding the position of the last underscore in the string
558558 let lastUnderscoreIndex = key . lastIndexOf ( '_' ) ;
559559
@@ -571,7 +571,7 @@ function getCollectionKey(key: CollectionKey): string | null {
571571 lastUnderscoreIndex = key . lastIndexOf ( '_' , lastUnderscoreIndex - 1 ) ;
572572 }
573573
574- return null ;
574+ return undefined ;
575575}
576576
577577/**
@@ -750,7 +750,7 @@ function keyChanged<TKey extends OnyxKey>(
750750 // do the same in keysChanged, because we only call that function when a collection key changes, and it doesn't happen that often.
751751 // For performance reason, we look for the given key and later if don't find it we look for the collection key, instead of checking if it is a collection key first.
752752 let stateMappingKeys = onyxKeyToSubscriptionIDs . get ( key ) ?? [ ] ;
753- const collectionKey = getCollectionKey ( key ) ?? undefined ;
753+ const collectionKey = getCollectionKey ( key ) ;
754754
755755 if ( collectionKey ) {
756756 // Getting the collection key from the specific key because only collection keys were stored in the mapping.
0 commit comments