diff --git a/lib/Onyx.js b/lib/Onyx.js index 03542cac3..0e9ee4775 100644 --- a/lib/Onyx.js +++ b/lib/Onyx.js @@ -232,10 +232,10 @@ function getCachedCollection(collectionKey) { if (!cachedValue) { return prev; } - return ({ - ...prev, - [curr]: cachedValue, - }); + + // eslint-disable-next-line no-param-reassign + prev[curr] = cachedValue; + return prev; }, {}); } @@ -444,10 +444,11 @@ function connect(mapping) { // initial data as a single object when using collection keys. if ((mapping.withOnyxInstance && isCollectionKey(mapping.key)) || mapping.waitForCollectionCallback) { Promise.all(_.map(matchingKeys, key => get(key))) - .then(values => _.reduce(values, (finalObject, value, i) => ({ - ...finalObject, - [matchingKeys[i]]: value, - }), {})) + .then(values => _.reduce(values, (finalObject, value, i) => { + // eslint-disable-next-line no-param-reassign + finalObject[matchingKeys[i]] = value; + return finalObject; + }, {})) .then(val => sendDataToConnection(mapping, val)); } else { _.each(matchingKeys, (key) => {