react-native-onyx 1.0.115 → 1.0.117
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/web.development.js +6 -5
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/Onyx.js +6 -5
- package/package.json +1 -1
package/lib/Onyx.js
CHANGED
|
@@ -1197,11 +1197,6 @@ function merge(key, changes) {
|
|
|
1197
1197
|
// We don't want to remove null values from the "batchedChanges", because SQLite uses them to remove keys from storage natively.
|
|
1198
1198
|
let batchedChanges = applyMerge(undefined, mergeQueue[key], false);
|
|
1199
1199
|
|
|
1200
|
-
if (_.isNull(batchedChanges)) {
|
|
1201
|
-
remove(key);
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
1200
|
// The presence of a `null` in the merge queue instructs us to drop the existing value.
|
|
1206
1201
|
// 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
|
|
1207
1202
|
const shouldOverwriteExistingValue = _.includes(mergeQueue[key], null);
|
|
@@ -1210,6 +1205,12 @@ function merge(key, changes) {
|
|
|
1210
1205
|
delete mergeQueue[key];
|
|
1211
1206
|
delete mergeQueuePromise[key];
|
|
1212
1207
|
|
|
1208
|
+
// If the batched changes equal null, we want to remove the key from storage, to reduce storage size
|
|
1209
|
+
if (_.isNull(batchedChanges)) {
|
|
1210
|
+
remove(key);
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1213
1214
|
// After that we merge the batched changes with the existing value
|
|
1214
1215
|
// We can remove null values from the "modifiedData", because "null" implicates that the user wants to remove a value from storage.
|
|
1215
1216
|
// The "modifiedData" will be directly "set" in storage instead of being merged
|