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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Removal in Nested Producers are Hanging the Browser #628

Closed
3 tasks done
rafaelcalpena opened this issue Jun 19, 2020 · 4 comments
Closed
3 tasks done

Set Removal in Nested Producers are Hanging the Browser #628

rafaelcalpena opened this issue Jun 19, 2020 · 4 comments

Comments

@rafaelcalpena
Copy link

馃悰 Bug Report

When removing an array from a Set inside nested producers, the code will hang.

Link to repro

https://codesandbox.io/s/immer-bug-2qsbe?file=/src/index.ts

To Reproduce

  1. Create an array (or object)
  2. Create a Set with the previously created array as one of its elements.
  3. Nest 2 produce calls, with second call producing from draft of outer producer.
  4. Inside nested producer, delete the array from the set.

Observed behavior

The code never returns and gets stuck. Note: This doesn't happen with numbers (instead of arrays, please check sandbox example). Also does not happen if provided array is not inserted in the Set.

Expected behavior

Code should return Set with removed element.

Environment

We only accept bug reports against the latest Immer version.

  • Immer version:
  • I filed this report against the latest version of Immer
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)
@mweststrate
Copy link
Collaborator

Can you reproduce this outside sandbox? For me the sandbox crashes even if I remove all code and immer as dep and just leave a console.log.

@rafaelcalpena
Copy link
Author

rafaelcalpena commented Jun 21, 2020

@mweststrate I faced a similar issue too. I was able to "fix" the sandbox crash it by opening the preview in Firefox (it has a stop script button). Also needed to save all files and reload the preview twice consecutively. That may be the same reason why the sandbox is crashing for you.

As for reproducing the bug outside of the sandbox, it first happened when I was testing some code in Karma (same bug behavior)

@mweststrate
Copy link
Collaborator

Added a fix that will address the crash, but I don't think the double produce nesting in the end does what you might expect here, so it might need a revisit

@aleclarson
Copy link
Member

馃帀 This issue has been resolved in version 7.0.7 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants