react-native-onyx 3.0.46 → 3.0.48

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.
@@ -40,7 +40,7 @@ declare class OnyxSnapshotCache {
40
40
  * - `selector`: Different selectors produce different results, so each selector needs its own cache entry
41
41
  * - `initWithStoredValues`: This flag changes the initial loading behavior and affects the returned fetch status
42
42
  *
43
- * Other options like `canEvict`, `reuseConnection`, and `allowDynamicKey` don't affect the data transformation
43
+ * Other options like `canEvict` and `reuseConnection` don't affect the data transformation
44
44
  * or timing behavior of getSnapshot, so they're excluded from the cache key for better cache hit rates.
45
45
  */
46
46
  registerConsumer<TKey extends OnyxKey, TReturnValue>(options: Pick<UseOnyxOptions<TKey, TReturnValue>, 'selector' | 'initWithStoredValues'>): string;
@@ -37,7 +37,7 @@ class OnyxSnapshotCache {
37
37
  * - `selector`: Different selectors produce different results, so each selector needs its own cache entry
38
38
  * - `initWithStoredValues`: This flag changes the initial loading behavior and affects the returned fetch status
39
39
  *
40
- * Other options like `canEvict`, `reuseConnection`, and `allowDynamicKey` don't affect the data transformation
40
+ * Other options like `canEvict` and `reuseConnection` don't affect the data transformation
41
41
  * or timing behavior of getSnapshot, so they're excluded from the cache key for better cache hit rates.
42
42
  */
43
43
  registerConsumer(options) {
package/dist/useOnyx.d.ts CHANGED
@@ -16,10 +16,6 @@ type UseOnyxOptions<TKey extends OnyxKey, TReturnValue> = {
16
16
  * with the same connect configurations.
17
17
  */
18
18
  reuseConnection?: boolean;
19
- /**
20
- * If set to `true`, the key can be changed dynamically during the component lifecycle.
21
- */
22
- allowDynamicKey?: boolean;
23
19
  /**
24
20
  * This will be used to subscribe to a subset of an Onyx key's data.
25
21
  * Using this setting on `useOnyx` can have very positive performance benefits because the component will only re-render
package/dist/useOnyx.js CHANGED
@@ -111,23 +111,6 @@ function useOnyx(key, options, dependencies = []) {
111
111
  initWithStoredValues: options === null || options === void 0 ? void 0 : options.initWithStoredValues,
112
112
  }), [options === null || options === void 0 ? void 0 : options.selector, options === null || options === void 0 ? void 0 : options.initWithStoredValues]);
113
113
  (0, react_1.useEffect)(() => () => OnyxSnapshotCache_1.default.deregisterConsumer(key, cacheKey), [key, cacheKey]);
114
- (0, react_1.useEffect)(() => {
115
- // These conditions will ensure we can only handle dynamic collection member keys from the same collection.
116
- if ((options === null || options === void 0 ? void 0 : options.allowDynamicKey) || previousKey === key) {
117
- return;
118
- }
119
- try {
120
- const previousCollectionKey = OnyxUtils_1.default.splitCollectionMemberKey(previousKey)[0];
121
- const collectionKey = OnyxUtils_1.default.splitCollectionMemberKey(key)[0];
122
- if (OnyxUtils_1.default.isCollectionMemberKey(previousCollectionKey, previousKey) && OnyxUtils_1.default.isCollectionMemberKey(collectionKey, key) && previousCollectionKey === collectionKey) {
123
- return;
124
- }
125
- }
126
- catch (e) {
127
- throw new Error(`'${previousKey}' key can't be changed to '${key}'. useOnyx() only supports dynamic keys if they are both collection member keys from the same collection e.g. from 'collection_id1' to 'collection_id2'.`);
128
- }
129
- throw new Error(`'${previousKey}' key can't be changed to '${key}'. useOnyx() only supports dynamic keys if they are both collection member keys from the same collection e.g. from 'collection_id1' to 'collection_id2'.`);
130
- }, [previousKey, key, options === null || options === void 0 ? void 0 : options.allowDynamicKey]);
131
114
  // Track previous dependencies to prevent infinite loops
132
115
  const previousDependenciesRef = (0, react_1.useRef)([]);
133
116
  (0, react_1.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "3.0.46",
3
+ "version": "3.0.48",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",
@@ -53,6 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@actions/core": "^1.10.1",
56
+ "@actions/github": "^6.0.1",
56
57
  "@jest/globals": "^29.7.0",
57
58
  "@lwc/eslint-plugin-lwc": "^3.3.0",
58
59
  "@ngneat/falso": "^7.3.0",