Skip to content

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

@kdelmonte

Description

@kdelmonte

🐛 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions