react-native-gifted-listview icon indicating copy to clipboard operation
react-native-gifted-listview copied to clipboard

Incorrect merge behavior for data with existing sections

Open Oxyaction opened this issue 7 years ago • 0 comments

Current implementation of MergeRecursive function works incorrectly when loading a new page with header that already exists, new data completely overwrites old. Consider the following example:

const a = { monday: ['a', 'b', 'c'] };
const b = { monday: ['d', 'e'], tuesday: ['f'] };
MergeRecursive(a, b);

gives

{ monday: [ 'd', 'e' ], tuesday: [ 'f' ] }

instead of expected

{ monday: ['a', 'b', 'c', 'd', 'e' ], tuesday: [ 'f' ] }

so to get this feature work correctly we need either prefetch all pages before current too, which is totally inefficient of course or to merge new data with old before passing it to the callback which is not so convenient.

Oxyaction avatar Apr 07 '17 16:04 Oxyaction