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

IE11 breaks if window.location is passed to produce #504

Closed
2 tasks done
kdelmonte opened this issue Jan 10, 2020 · 3 comments
Closed
2 tasks done

IE11 breaks if window.location is passed to produce #504

kdelmonte opened this issue Jan 10, 2020 · 3 comments

Comments

@kdelmonte
Copy link
Contributor

kdelmonte commented Jan 10, 2020

🐛 Bug Report

If you pass window.location as the draft to produce, IE11 throws an error. The error is essentially the same one described in this core-js issue.

In short, IE11's native Object.getOwnPropertyDescriptor can't work with environment exotic objects which is the cause for this bug.

You can easily reproduce the issue by pasting this in your IE11 Dev Tools and hitting enter.

Object.getOwnPropertyDescriptor(window.location, 'host')

Link to repro

https://github.com/kdelmonte/immer-ie11-window-location-bug

To Reproduce

To verify that the app loads fine in IE 11 without this bug:

  • Comment out the lines 9-11 in the src/index.js file
  • Run yarn build && serve -s build once again

Observed behavior

If you pass window.location as the draft to produce, IE11 throws an error.

Expected behavior

produce should be able to successfully create a draft from any object in any of the supported browsers.

Environment

  • Latest version of Windows 10
  • Latest version of IE11
  • Immer 5.2.0
  • Immer version:
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)
@illuminist
Copy link

Immutability with normal JavaScript objects, arrays, Sets and Maps.

I might be wrong, but immer isn't intended to be used with exotic object.

@kdelmonte
Copy link
Contributor Author

Immutability with normal JavaScript objects, arrays, Sets and Maps.

I might be wrong, but immer isn't intended to be used with exotic object.

@illuminist I think the docs use the phrase "normal JavaScript objects, arrays, Sets and Maps" to highlight the fact that immer does not have its own types such as Immutable.js. I don't think the phrase is there to explicitly exclude exotics.

In any case, if this is true and the immer community has no interest in supporting exotics, the docs should be updated to reflect this. Let's see what the maintainers have to say.

@mweststrate
Copy link
Collaborator

mweststrate commented Jan 29, 2020 via email

kdelmonte added a commit to kdelmonte/immer that referenced this issue Jan 29, 2020
mweststrate added a commit that referenced this issue Jan 29, 2020
Include note about exotic objects not being supported #504
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

No branches or pull requests

3 participants