Skip to content

Commit ae14d54

Browse files
committed
Limit use of unnecessary spread
1 parent 21a2693 commit ae14d54

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

lib/Onyx.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ function getCachedCollection(collectionKey) {
232232
if (!cachedValue) {
233233
return prev;
234234
}
235-
return ({
236-
...prev,
237-
[curr]: cachedValue,
238-
});
235+
236+
// eslint-disable-next-line no-param-reassign
237+
prev[curr] = cachedValue;
238+
return prev;
239239
}, {});
240240
}
241241

@@ -444,10 +444,11 @@ function connect(mapping) {
444444
// initial data as a single object when using collection keys.
445445
if ((mapping.withOnyxInstance && isCollectionKey(mapping.key)) || mapping.waitForCollectionCallback) {
446446
Promise.all(_.map(matchingKeys, key => get(key)))
447-
.then(values => _.reduce(values, (finalObject, value, i) => ({
448-
...finalObject,
449-
[matchingKeys[i]]: value,
450-
}), {}))
447+
.then(values => _.reduce(values, (finalObject, value, i) => {
448+
// eslint-disable-next-line no-param-reassign
449+
finalObject[matchingKeys[i]] = value;
450+
return finalObject;
451+
}, {}))
451452
.then(val => sendDataToConnection(mapping, val));
452453
} else {
453454
_.each(matchingKeys, (key) => {

0 commit comments

Comments
 (0)