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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object.assign polyfill does not match spec (causing error on browsers without Object.assign) #477
Comments
Thanks for the detailed bug report! This really helps. A new version (5.0.1) should be published by CI soon. |
馃帀 This issue has been resolved in version 5.0.1 馃帀 The release is available on: Your semantic-release bot 馃摝馃殌 |
For me this fix isn't working. It's giving me the following error on a HTC One M9: "undefined" isn't a function Falling back to 4.0.2 (works with older specs browsers) [edit] verified 4.0.2 works |
@mweststrate As mentioned in my OP, I didn't actually hit this error in production -- I just discovered the issue while copying the That said, the console-based test/usage I described earlier now passes. (but you probably already knew that) Anyway, thanks for the quick fix! Open-source development on GitHub is so much more streamlined than the painstaking bug-report processes for enterprise/legacy software. (like Windows issues that I've seen in multiple versions, left unfixed for over half a decade) |
Our team also switched back to the 4.0.2 version of immer as the versions 5.0.0 and 5.0.1 of immer throw an "Object.assign undefined" error in the IE11 browser. |
@majesticuser @FKobus please note that this issue is resolved and closed. Same symptoms !== same issue. So if you want your issue to be looked into, please take the courtesy to file a new issue, and take this issue as example on how to provide actionable information rather than throwing symptoms over the wall :) This project is maintained for you for free, so please make things at least as easy for us as you can! |
馃悰 Bug Report
The Object.assign polyfill does not satisfy the Object.assign spec; it errors if it's passed "null" as the second (or later) argument.
To Reproduce
The code below works with
Object.assign
, but fails for the polyfill:The
assign
function is declared here:immer/src/common.js
Lines 64 to 71 in d3be40e
So to reproduce in console, just copy that
assign
function (removing theObject.assign ||
part of course), then run the code in the first code block.Expected behavior
The function should not error. Instead, it should return null, like Object.assign does.
Link to repro (highly encouraged)
Not needed, since can repro directly in console.
Why does it matter
It matters because the immer module itself calls
assign
with the third argument asnull
:Step1) https://github.com/immerjs/immer/blob/master/src/index.js#L3
Step2) https://github.com/immerjs/immer/blob/master/src/immer.js#L40
Thus, by default, just importing the immer module crashes browsers that do not have
Object.assign
defined!(I discovered this issue when I grabbed the Object.assign polyfill from immer for some other purpose, but then noticed that it errorred with null arguments provided)
Environment
The text was updated successfully, but these errors were encountered: