Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Files not being replaced on a deep merge #265

@ericdsmith

Description

@ericdsmith

On a deep merge of an Immutable object, properties that have a file are not being replaced. An example of the current behavior:

var oldObj = Immutable({ file: new File([''], 'oldFile') })
var newObj = oldObj.merge({ file: new File([''], 'newFile') }, { deep: true })
console.log(newObj.file.name) // outputs ==> ’oldFile’

I would expect the old file to be replaced with the new file. In looking at the code, the merge function attempts to to merge the two files which fails because Object.getOwnPropertyDescriptor returns undefined for a File’s properties. Updating isMergableObject to check if the object is a File or Blob would fix this issue. Happy to put up a PR if that approach seems reasonable.

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