|
1 | 1 | import _ from 'underscore'; |
2 | 2 | import Str from 'expensify-common/lib/str'; |
3 | 3 | import lodashMerge from 'lodash/merge'; |
4 | | -import lodashMergeWith from 'lodash/mergeWith'; |
5 | 4 | import lodashGet from 'lodash/get'; |
6 | 5 | import Storage from './storage'; |
7 | 6 | import * as Logger from './Logger'; |
8 | 7 | import cache from './OnyxCache'; |
9 | 8 | import createDeferredTask from './createDeferredTask'; |
10 | | -import customizerForMergeWith from './customizerForMergeWith'; |
| 9 | +import mergeWithCustomized from './mergeWithCustomized'; |
11 | 10 |
|
12 | 11 | // Keeps track of the last connectionID that was used so we can keep incrementing it |
13 | 12 | let lastConnectionID = 0; |
@@ -663,7 +662,7 @@ function applyMerge(key, data) { |
663 | 662 | if (_.isObject(data) || _.every(mergeValues, _.isObject)) { |
664 | 663 | // Object values are merged one after the other |
665 | 664 | return _.reduce(mergeValues, (modifiedData, mergeValue) => { |
666 | | - const newData = lodashMergeWith({}, modifiedData, mergeValue, customizerForMergeWith); |
| 665 | + const newData = mergeWithCustomized({}, modifiedData, mergeValue); |
667 | 666 |
|
668 | 667 | // We will also delete any object keys that are undefined or null. |
669 | 668 | // Deleting keys is not supported by AsyncStorage so we do it this way. |
@@ -734,7 +733,7 @@ function initializeWithDefaultKeyStates() { |
734 | 733 | .then((pairs) => { |
735 | 734 | const asObject = _.object(pairs); |
736 | 735 |
|
737 | | - const merged = lodashMergeWith(asObject, defaultKeyStates, customizerForMergeWith); |
| 736 | + const merged = mergeWithCustomized(asObject, defaultKeyStates); |
738 | 737 | cache.merge(merged); |
739 | 738 | _.each(merged, (val, key) => keyChanged(key, val)); |
740 | 739 | }); |
|
0 commit comments