|
| 1 | +diff --git a/node_modules/react-native-onyx/dist/OnyxUtils.js b/node_modules/react-native-onyx/dist/OnyxUtils.js |
| 2 | +index de56f94..495d378 100644 |
| 3 | +--- a/node_modules/react-native-onyx/dist/OnyxUtils.js |
| 4 | ++++ b/node_modules/react-native-onyx/dist/OnyxUtils.js |
| 5 | +@@ -868,24 +868,6 @@ function subscribeToKey(connectOptions) { |
| 6 | + const subscriptionID = lastSubscriptionID++; |
| 7 | + callbackToStateMapping[subscriptionID] = mapping; |
| 8 | + callbackToStateMapping[subscriptionID].subscriptionID = subscriptionID; |
| 9 | +- // If the subscriber is attempting to connect to a collection member whose ID is skippable (e.g. "undefined", "null", etc.) |
| 10 | +- // we suppress wiring the subscription fully to avoid unnecessary callback emissions such as for "report_undefined". |
| 11 | +- // We still return a valid subscriptionID so callers can disconnect safely. |
| 12 | +- try { |
| 13 | +- const skippableIDs = getSkippableCollectionMemberIDs(); |
| 14 | +- if (skippableIDs.size) { |
| 15 | +- const [, collectionMemberID] = OnyxKeys_1.default.splitCollectionMemberKey(mapping.key); |
| 16 | +- if (skippableIDs.has(collectionMemberID)) { |
| 17 | +- // Clean up the provisional mapping to avoid retaining unused subscribers. |
| 18 | +- OnyxCache_1.default.addNullishStorageKey(mapping.key); |
| 19 | +- delete callbackToStateMapping[subscriptionID]; |
| 20 | +- return subscriptionID; |
| 21 | +- } |
| 22 | +- } |
| 23 | +- } |
| 24 | +- catch (e) { |
| 25 | +- // Not a collection member key, proceed as usual. |
| 26 | +- } |
| 27 | + // 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 |
| 28 | + // to avoid having to loop through all the Subscribers all the time (even when just one connection belongs to one key), |
| 29 | + // We create a mapping from key to lists of subscriptionIDs to access the specific list of subscriptionIDs. |
| 30 | +@@ -1394,12 +1376,6 @@ function logKeyChanged(onyxMethod, key, value, hasChanged) { |
| 31 | + function logKeyRemoved(onyxMethod, key) { |
| 32 | + Logger.logInfo(`${onyxMethod} called for key: ${key} => null passed, so key was removed`); |
| 33 | + } |
| 34 | +-/** |
| 35 | +- * Getter - returns the callback to state mapping, useful in test environments. |
| 36 | +- */ |
| 37 | +-function getCallbackToStateMapping() { |
| 38 | +- return callbackToStateMapping; |
| 39 | +-} |
| 40 | + /** |
| 41 | + * Clear internal variables used in this file, useful in test environments. |
| 42 | + */ |
| 43 | +@@ -1458,6 +1434,5 @@ const OnyxUtils = { |
| 44 | + setWithRetry, |
| 45 | + multiSetWithRetry, |
| 46 | + setCollectionWithRetry, |
| 47 | +- getCallbackToStateMapping, |
| 48 | + }; |
| 49 | + exports.default = OnyxUtils; |
| 50 | +diff --git a/node_modules/react-native-onyx/dist/useOnyx.js b/node_modules/react-native-onyx/dist/useOnyx.js |
| 51 | +index 9213cff..2e48c73 100644 |
| 52 | +--- a/node_modules/react-native-onyx/dist/useOnyx.js |
| 53 | ++++ b/node_modules/react-native-onyx/dist/useOnyx.js |
| 54 | +@@ -220,12 +220,8 @@ function useOnyx(key, options, dependencies = []) { |
| 55 | + newValueRef.current = null; |
| 56 | + sourceValueRef.current = undefined; |
| 57 | + resultRef.current = [undefined, { status: (options === null || options === void 0 ? void 0 : options.initWithStoredValues) === false ? 'loaded' : 'loading' }]; |
| 58 | ++ shouldGetCachedValueRef.current = true; |
| 59 | + } |
| 60 | +- // Force a cache re-read on every (re)subscription so any side effects from |
| 61 | +- // subscribeToKey (e.g. addNullishStorageKey for skippable collection member ids) |
| 62 | +- // are reflected in the next getSnapshot. Resetting this flag does not change |
| 63 | +- // resultRef by itself, so it doesn't cause an extra mount render. |
| 64 | +- shouldGetCachedValueRef.current = true; |
| 65 | + hasMountedRef.current = true; |
| 66 | + isConnectingRef.current = true; |
| 67 | + onStoreChangeFnRef.current = onStoreChange; |
0 commit comments