Skip to content

Commit 98bd0fe

Browse files
authored
Merge pull request #638 from FitseTLT/fix-updateSnapshots-to-remove-picking-existing-keys
2 parents fe8af83 + dfe80ea commit 98bd0fe

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

lib/OnyxUtils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import {deepEqual} from 'fast-equals';
33
import lodashClone from 'lodash/clone';
44
import type {ValueOf} from 'type-fest';
5-
import lodashPick from 'lodash/pick';
65
import DevTools from './DevTools';
76
import * as Logger from './Logger';
87
import type Onyx from './Onyx';
@@ -1417,9 +1416,8 @@ function updateSnapshots(data: OnyxUpdate[], mergeFn: typeof Onyx.merge): Array<
14171416
}
14181417

14191418
const oldValue = updatedData[key] || {};
1420-
const newValue = lodashPick(value, Object.keys(snapshotData[key]));
14211419

1422-
updatedData = {...updatedData, [key]: Object.assign(oldValue, newValue)};
1420+
updatedData = {...updatedData, [key]: Object.assign(oldValue, value)};
14231421
});
14241422

14251423
// Skip the update if there's no data to be merged

tests/unit/onyxTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ describe('Onyx', () => {
14481448
const snapshot1 = `${ONYX_KEYS.COLLECTION.SNAPSHOT}1`;
14491449

14501450
const initialValue = {name: 'Fluffy'};
1451-
const finalValue = {name: 'Kitty'};
1451+
const finalValue = {name: 'Kitty', nickName: 'Fitse'};
14521452

14531453
await Onyx.set(cat, initialValue);
14541454
await Onyx.set(snapshot1, {data: {[cat]: initialValue}});

0 commit comments

Comments
 (0)