react-native-onyx 1.0.89 → 1.0.91

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.
@@ -885,7 +885,19 @@ function connect(mapping) {
885
885
  // Commit connection only after init passes
886
886
  deferredInitTask.promise.
887
887
  then(() => addKeyToRecentlyAccessedIfNeeded(mapping)).
888
- then(getAllKeys).
888
+ then(() => {
889
+ // Performance improvement
890
+ // If the mapping is connected to an onyx key that is not a collection
891
+ // we can skip the call to getAllKeys() and return an array with a single item
892
+ if (Boolean(mapping.key) &&
893
+ typeof mapping.key === 'string' &&
894
+ !mapping.key.endsWith('_') &&
895
+ _OnyxCache__WEBPACK_IMPORTED_MODULE_4__["default"].storageKeys.has(mapping.key))
896
+ {
897
+ return [mapping.key];
898
+ }
899
+ return getAllKeys();
900
+ }).
889
901
  then((keys) => {
890
902
  // We search all the keys in storage to see if any are a "match" for the subscriber we are connecting so that we
891
903
  // can send data back to the subscriber. Note that multiple keys can match as a subscriber could either be
@@ -2132,6 +2144,9 @@ const webStorage = {
2132
2144
  this.removeItems = (keys) => _providers_IDBKeyVal__WEBPACK_IMPORTED_MODULE_1__["default"].removeItems(keys).
2133
2145
  then(() => raiseStorageSyncManyKeysEvent(keys));
2134
2146
 
2147
+ this.mergeItem = (key, batchedChanges, modifiedData) => _providers_IDBKeyVal__WEBPACK_IMPORTED_MODULE_1__["default"].mergeItem(key, batchedChanges, modifiedData).
2148
+ then(() => raiseStorageSyncEvent(key));
2149
+
2135
2150
  // If we just call Storage.clear other tabs will have no idea which keys were available previously
2136
2151
  // so that they can call keysChanged for them. That's why we iterate over every key and raise a storage sync
2137
2152
  // event for each one