react-native-onyx 2.0.98 → 2.0.99
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 +6 -6
- package/package.json +1 -1
package/dist/Onyx.js
CHANGED
|
@@ -543,7 +543,7 @@ function clear(keysToPreserve = []) {
|
|
|
543
543
|
function updateSnapshots(data) {
|
|
544
544
|
const snapshotCollectionKey = OnyxUtils_1.default.getSnapshotKey();
|
|
545
545
|
if (!snapshotCollectionKey)
|
|
546
|
-
return;
|
|
546
|
+
return [];
|
|
547
547
|
const promises = [];
|
|
548
548
|
const snapshotCollection = OnyxUtils_1.default.getCachedCollection(snapshotCollectionKey);
|
|
549
549
|
const snapshotCollectionKeyLength = snapshotCollectionKey.length;
|
|
@@ -583,7 +583,7 @@ function updateSnapshots(data) {
|
|
|
583
583
|
}
|
|
584
584
|
promises.push(() => merge(snapshotKey, { data: updatedData }));
|
|
585
585
|
});
|
|
586
|
-
return
|
|
586
|
+
return promises;
|
|
587
587
|
}
|
|
588
588
|
/**
|
|
589
589
|
* Insert API responses and lifecycle data into Onyx
|
|
@@ -699,10 +699,10 @@ function update(data) {
|
|
|
699
699
|
promises.push(() => merge(key, batchedChanges));
|
|
700
700
|
}
|
|
701
701
|
});
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
702
|
+
const snapshotPromises = updateSnapshots(data);
|
|
703
|
+
// 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
|
|
704
|
+
const finalPromises = snapshotPromises.concat(promises);
|
|
705
|
+
return clearPromise.then(() => Promise.all(finalPromises.map((p) => p()))).then(() => undefined);
|
|
706
706
|
}
|
|
707
707
|
/**
|
|
708
708
|
* Sets a collection by replacing all existing collection members with new values.
|