Skip to content

Incorrect merge behavior for data with existing sections #98

@Oxyaction

Description

@Oxyaction

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions