react-native-onyx 3.0.74 → 3.0.75

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.
@@ -254,10 +254,6 @@ declare function mergeCollectionWithPatches<TKey extends CollectionKeyBase>({ co
254
254
  declare function partialSetCollection<TKey extends CollectionKeyBase>({ collectionKey, collection }: SetCollectionParams<TKey>, retryAttempt?: number): Promise<void>;
255
255
  declare function logKeyChanged(onyxMethod: Extract<OnyxMethod, 'set' | 'merge'>, key: OnyxKey, value: unknown, hasChanged: boolean): void;
256
256
  declare function logKeyRemoved(onyxMethod: Extract<OnyxMethod, 'set' | 'merge'>, key: OnyxKey): void;
257
- /**
258
- * Getter - returns the callback to state mapping, useful in test environments.
259
- */
260
- declare function getCallbackToStateMapping(): Record<number, CallbackToStateMapping<OnyxKey>>;
261
257
  /**
262
258
  * Clear internal variables used in this file, useful in test environments.
263
259
  */
@@ -317,7 +313,6 @@ declare const OnyxUtils: {
317
313
  setWithRetry: typeof setWithRetry;
318
314
  multiSetWithRetry: typeof multiSetWithRetry;
319
315
  setCollectionWithRetry: typeof setCollectionWithRetry;
320
- getCallbackToStateMapping: typeof getCallbackToStateMapping;
321
316
  };
322
317
  export type { OnyxMethod };
323
318
  export default OnyxUtils;
package/dist/OnyxUtils.js CHANGED
@@ -882,24 +882,6 @@ function subscribeToKey(connectOptions) {
882
882
  const subscriptionID = lastSubscriptionID++;
883
883
  callbackToStateMapping[subscriptionID] = mapping;
884
884
  callbackToStateMapping[subscriptionID].subscriptionID = subscriptionID;
885
- // If the subscriber is attempting to connect to a collection member whose ID is skippable (e.g. "undefined", "null", etc.)
886
- // we suppress wiring the subscription fully to avoid unnecessary callback emissions such as for "report_undefined".
887
- // We still return a valid subscriptionID so callers can disconnect safely.
888
- try {
889
- const skippableIDs = getSkippableCollectionMemberIDs();
890
- if (skippableIDs.size) {
891
- const [, collectionMemberID] = OnyxKeys_1.default.splitCollectionMemberKey(mapping.key);
892
- if (skippableIDs.has(collectionMemberID)) {
893
- // Clean up the provisional mapping to avoid retaining unused subscribers.
894
- OnyxCache_1.default.addNullishStorageKey(mapping.key);
895
- delete callbackToStateMapping[subscriptionID];
896
- return subscriptionID;
897
- }
898
- }
899
- }
900
- catch (e) {
901
- // Not a collection member key, proceed as usual.
902
- }
903
885
  // When keyChanged is called, a key is passed and the method looks through all the Subscribers in callbackToStateMapping for the matching key to get the subscriptionID
904
886
  // to avoid having to loop through all the Subscribers all the time (even when just one connection belongs to one key),
905
887
  // We create a mapping from key to lists of subscriptionIDs to access the specific list of subscriptionIDs.
@@ -1433,12 +1415,6 @@ function logKeyChanged(onyxMethod, key, value, hasChanged) {
1433
1415
  function logKeyRemoved(onyxMethod, key) {
1434
1416
  Logger.logInfo(`${onyxMethod} called for key: ${key} => null passed, so key was removed`);
1435
1417
  }
1436
- /**
1437
- * Getter - returns the callback to state mapping, useful in test environments.
1438
- */
1439
- function getCallbackToStateMapping() {
1440
- return callbackToStateMapping;
1441
- }
1442
1418
  /**
1443
1419
  * Clear internal variables used in this file, useful in test environments.
1444
1420
  */
@@ -1497,6 +1473,5 @@ const OnyxUtils = {
1497
1473
  setWithRetry,
1498
1474
  multiSetWithRetry,
1499
1475
  setCollectionWithRetry,
1500
- getCallbackToStateMapping,
1501
1476
  };
1502
1477
  exports.default = OnyxUtils;
package/dist/useOnyx.js CHANGED
@@ -210,12 +210,8 @@ function useOnyx(key, options, dependencies = []) {
210
210
  newValueRef.current = null;
211
211
  sourceValueRef.current = undefined;
212
212
  resultRef.current = [undefined, { status: 'loading' }];
213
+ shouldGetCachedValueRef.current = true;
213
214
  }
214
- // Force a cache re-read on every (re)subscription so any side effects from
215
- // subscribeToKey (e.g. addNullishStorageKey for skippable collection member ids)
216
- // are reflected in the next getSnapshot. Resetting this flag does not change
217
- // resultRef by itself, so it doesn't cause an extra mount render.
218
- shouldGetCachedValueRef.current = true;
219
215
  hasMountedRef.current = true;
220
216
  isConnectingRef.current = true;
221
217
  onStoreChangeFnRef.current = onStoreChange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "3.0.74",
3
+ "version": "3.0.75",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",