react-native-onyx 2.0.106 → 2.0.108

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
@@ -208,6 +208,11 @@ function multiSet(data) {
208
208
  const keyValuePairsToSet = OnyxUtils_1.default.prepareKeyValuePairsForStorage(newData, true);
209
209
  const updatePromises = keyValuePairsToSet.map(([key, value]) => {
210
210
  const prevValue = OnyxCache_1.default.get(key, false);
211
+ // When we use multiSet to set a key we want to clear the current delta changes from Onyx.merge that were queued
212
+ // before the value was set. If Onyx.merge is currently reading the old value from storage, it will then not apply the changes.
213
+ if (OnyxUtils_1.default.hasPendingMergeForKey(key)) {
214
+ delete OnyxUtils_1.default.getMergeQueue()[key];
215
+ }
211
216
  // Update cache and optimistically inform subscribers on the next tick
212
217
  OnyxCache_1.default.set(key, value);
213
218
  return OnyxUtils_1.default.scheduleSubscriberUpdate(key, value, prevValue);
package/dist/OnyxUtils.js CHANGED
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  /* eslint-disable no-continue */
30
30
  const fast_equals_1 = require("fast-equals");
31
31
  const clone_1 = __importDefault(require("lodash/clone"));
32
- const pick_1 = __importDefault(require("lodash/pick"));
33
32
  const DevTools_1 = __importDefault(require("./DevTools"));
34
33
  const Logger = __importStar(require("./Logger"));
35
34
  const OnyxCache_1 = __importStar(require("./OnyxCache"));
@@ -1150,8 +1149,7 @@ function updateSnapshots(data, mergeFn) {
1150
1149
  return;
1151
1150
  }
1152
1151
  const oldValue = updatedData[key] || {};
1153
- const newValue = (0, pick_1.default)(value, Object.keys(snapshotData[key]));
1154
- updatedData = Object.assign(Object.assign({}, updatedData), { [key]: Object.assign(oldValue, newValue) });
1152
+ updatedData = Object.assign(Object.assign({}, updatedData), { [key]: Object.assign(oldValue, value) });
1155
1153
  });
1156
1154
  // Skip the update if there's no data to be merged
1157
1155
  if (utils_1.default.isEmptyObject(updatedData)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "2.0.106",
3
+ "version": "2.0.108",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",