react-native-onyx 1.0.8 → 1.0.11

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.
@@ -882,6 +882,7 @@ function sendDataToConnection(config, val, key) {
882
882
  * This is used by any non-React code to connect to Onyx
883
883
  * @param {Boolean} [mapping.initWithStoredValues] If set to false, then no data will be prefilled into the
884
884
  * component
885
+ * @param {Boolean} [mapping.waitForCollectionCallback] If set to true, it will trigger the callback once and return all data as a single object
885
886
  * @returns {Number} an ID to use when calling disconnect
886
887
  */
887
888
  function connect(mapping) {
@@ -932,7 +933,7 @@ function connect(mapping) {
932
933
  // to expect a single key or multiple keys in the case of a collection.
933
934
  // React components are an exception since we'll want to send their
934
935
  // initial data as a single object when using collection keys.
935
- if (mapping.withOnyxInstance && isCollectionKey(mapping.key)) {
936
+ if (mapping.withOnyxInstance && isCollectionKey(mapping.key) || mapping.waitForCollectionCallback) {
936
937
  Promise.all(_underscore.default.map(matchingKeys, function (key) {return get(key);})).
937
938
  then(function (values) {return _underscore.default.reduce(values, function (finalObject, value, i) {return (0, _extends4.default)({},
938
939
  finalObject, (0, _defineProperty2.default)({},
@@ -1308,7 +1309,7 @@ function mergeCollection(collectionKey, collection) {
1308
1309
  function update(data) {
1309
1310
  // First, validate the Onyx object is in the format we expect
1310
1311
  _underscore.default.each(data, function (_ref4) {var onyxMethod = _ref4.onyxMethod,key = _ref4.key;
1311
- if (!_underscore.default.contains(['clear', 'set', 'merge', 'mergeCollection'], onyxMethod)) {
1312
+ if (!_underscore.default.contains(['clear', 'set', 'merge', 'mergecollection'], onyxMethod)) {
1312
1313
  throw new Error("Invalid onyxMethod " + onyxMethod + " in Onyx update.");
1313
1314
  }
1314
1315
  if (onyxMethod !== 'clear' && !_underscore.default.isString(key)) {
@@ -1324,7 +1325,7 @@ function update(data) {
1324
1325
  case 'merge':
1325
1326
  merge(key, value);
1326
1327
  break;
1327
- case 'mergeCollection':
1328
+ case 'mergecollection':
1328
1329
  mergeCollection(key, value);
1329
1330
  break;
1330
1331
  case 'clear':