Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files not being replaced on a deep merge #265

Open
ericdsmith opened this issue Jan 4, 2019 · 0 comments · May be fixed by #266
Open

Files not being replaced on a deep merge #265

ericdsmith opened this issue Jan 4, 2019 · 0 comments · May be fixed by #266

Comments

@ericdsmith
Copy link

ericdsmith commented Jan 4, 2019

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.

@ericdsmith ericdsmith linked a pull request Feb 20, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant