react-native-onyx 2.0.120 → 2.0.122

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
@@ -158,7 +158,7 @@ function set(key, value, options) {
158
158
  OnyxUtils_1.default.logKeyRemoved(OnyxUtils_1.default.METHOD.SET, key);
159
159
  return Promise.resolve();
160
160
  }
161
- const valueWithoutNestedNullValues = ((options === null || options === void 0 ? void 0 : options.skipNullRemoval) ? value : utils_1.default.removeNestedNullValues(value));
161
+ const valueWithoutNestedNullValues = ((options === null || options === void 0 ? void 0 : options.skipNullRemoval) ? Object.assign({}, value) : utils_1.default.removeNestedNullValues(value));
162
162
  const hasChanged = (options === null || options === void 0 ? void 0 : options.skipCacheCheck) ? true : OnyxCache_1.default.hasValueChanged(key, valueWithoutNestedNullValues);
163
163
  OnyxUtils_1.default.logKeyChanged(OnyxUtils_1.default.METHOD.SET, key, value, hasChanged);
164
164
  // This approach prioritizes fast UI changes without waiting for data to be stored in device storage.
@@ -538,10 +538,9 @@ function update(data) {
538
538
  promises.push(() => set(key, batchedChanges));
539
539
  return;
540
540
  }
541
- const mergePromises = operations.map((operation) => {
542
- return merge(key, operation);
541
+ operations.forEach((operation) => {
542
+ promises.push(() => merge(key, operation));
543
543
  });
544
- promises.push(() => { var _a; return (_a = mergePromises.at(0)) !== null && _a !== void 0 ? _a : Promise.resolve(); });
545
544
  });
546
545
  const snapshotPromises = OnyxUtils_1.default.updateSnapshots(data, merge);
547
546
  // We need to run the snapshot updates before the other updates so the snapshot data can be updated before the loading state in the snapshot
package/dist/utils.js CHANGED
@@ -108,11 +108,11 @@ function isMergeableObject(value) {
108
108
  }
109
109
  /** Deep removes the nested null values from the given value. */
110
110
  function removeNestedNullValues(value) {
111
- if (value === null || value === undefined) {
111
+ if (value === null || value === undefined || typeof value !== 'object') {
112
112
  return value;
113
113
  }
114
- if (typeof value !== 'object' || Array.isArray(value)) {
115
- return value;
114
+ if (Array.isArray(value)) {
115
+ return [...value];
116
116
  }
117
117
  const result = {};
118
118
  // eslint-disable-next-line no-restricted-syntax, guard-for-in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "2.0.120",
3
+ "version": "2.0.122",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",