react-native-onyx 2.0.63 → 2.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Onyx.js CHANGED
@@ -510,8 +510,8 @@ function clear(keysToPreserve = []) {
510
510
  const newValue = (_a = defaultKeyStates[key]) !== null && _a !== void 0 ? _a : null;
511
511
  if (newValue !== oldValue) {
512
512
  OnyxCache_1.default.set(key, newValue);
513
- const collectionKey = key.substring(0, key.indexOf('_') + 1);
514
- if (collectionKey) {
513
+ const collectionKey = OnyxUtils_1.default.getCollectionKey(key);
514
+ if (OnyxUtils_1.default.isCollectionKey(collectionKey)) {
515
515
  if (!keyValuesToResetAsCollection[collectionKey]) {
516
516
  keyValuesToResetAsCollection[collectionKey] = {};
517
517
  }
@@ -85,7 +85,7 @@ declare function isCollectionMemberKey<TCollectionKey extends CollectionKeyBase>
85
85
  * @param key - The collection member key to split.
86
86
  * @returns A tuple where the first element is the collection part and the second element is the ID part.
87
87
  */
88
- declare function splitCollectionMemberKey<TKey extends CollectionKey>(key: TKey): [TKey extends `${infer Prefix}_${string}` ? `${Prefix}_` : never, string];
88
+ declare function splitCollectionMemberKey<TKey extends CollectionKey, CollectionKeyType = TKey extends `${infer Prefix}_${string}` ? `${Prefix}_` : never>(key: TKey): [CollectionKeyType, string];
89
89
  /**
90
90
  * Checks to see if a provided key is the exact configured key of our connected subscriber
91
91
  * or if the provided key is a collection member key (in case our configured key is a "collection key")
package/dist/OnyxUtils.js CHANGED
@@ -328,7 +328,9 @@ function splitCollectionMemberKey(key) {
328
328
  if (underscoreIndex === -1) {
329
329
  throw new Error(`Invalid ${key} key provided, only collection keys are allowed.`);
330
330
  }
331
- return [key.substring(0, underscoreIndex + 1), key.substring(underscoreIndex + 1)];
331
+ const collectionKey = key.substring(0, underscoreIndex + 1);
332
+ const memberKey = key.substring(underscoreIndex + 1);
333
+ return [collectionKey, memberKey];
332
334
  }
333
335
  /**
334
336
  * Checks to see if a provided key is the exact configured key of our connected subscriber
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "2.0.63",
3
+ "version": "2.0.64",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",