react-native-onyx 1.0.116 → 1.0.118-1

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.
@@ -1280,11 +1280,6 @@ function merge(key, changes) {
1280
1280
  // We don't want to remove null values from the "batchedChanges", because SQLite uses them to remove keys from storage natively.
1281
1281
  let batchedChanges = applyMerge(undefined, mergeQueue[key], false);
1282
1282
 
1283
- if (underscore__WEBPACK_IMPORTED_MODULE_1___default().isNull(batchedChanges)) {
1284
- remove(key);
1285
- return;
1286
- }
1287
-
1288
1283
  // The presence of a `null` in the merge queue instructs us to drop the existing value.
1289
1284
  // In this case, we can't simply merge the batched changes with the existing value, because then the null in the merge queue would have no effect
1290
1285
  const shouldOverwriteExistingValue = underscore__WEBPACK_IMPORTED_MODULE_1___default().includes(mergeQueue[key], null);
@@ -1293,6 +1288,12 @@ function merge(key, changes) {
1293
1288
  delete mergeQueue[key];
1294
1289
  delete mergeQueuePromise[key];
1295
1290
 
1291
+ // If the batched changes equal null, we want to remove the key from storage, to reduce storage size
1292
+ if (underscore__WEBPACK_IMPORTED_MODULE_1___default().isNull(batchedChanges)) {
1293
+ remove(key);
1294
+ return;
1295
+ }
1296
+
1296
1297
  // After that we merge the batched changes with the existing value
1297
1298
  // We can remove null values from the "modifiedData", because "null" implicates that the user wants to remove a value from storage.
1298
1299
  // The "modifiedData" will be directly "set" in storage instead of being merged