Skip to content

Merging array in DeepMerger #11704

@hartantothio

Description

@hartantothio

Issue Description

I'm looking at this line and I think it's a problem when I have the following data for source and target:

// New data
source: []

// Previous data
target: [{...}]

My expectation is that the data will be replaced with source, which is the most recent data. But in this case, because Object.keys([]) returns an empty array, it will returns target instead.

Link to Reproduction

n/a

Reproduction Steps

No response

@apollo/client version

3.9.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    ℹ needs-more-infoNeeds more information to determine root cause

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions