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

atomWithImmer doesn't work #1155

Closed
lgwebdream opened this issue May 14, 2022 · 3 comments
Closed

atomWithImmer doesn't work #1155

lgwebdream opened this issue May 14, 2022 · 3 comments

Comments

@lgwebdream
Copy link

object value doesn't change, but component is rendered repeatedly~
demo link
https://codesandbox.io/s/atomwithimmer-demo-u4pw0u?file=/src/App.js

@dai-shi
Copy link
Member

dai-shi commented May 14, 2022

If you wrap console.log with useEffect and the result is something expected, then it's not an issue, but an intentional behavior to make it better work with concurrent react.

https://codesandbox.io/s/atomwithimmer-demo-forked-th8820

@lgwebdream
Copy link
Author

If you wrap console.log with useEffect and the result is something expected, then it's not an issue, but an intentional behavior to make it better work with concurrent react.

https://codesandbox.io/s/atomwithimmer-demo-forked-th8820
I probably understand, thanks~

@dai-shi
Copy link
Member

dai-shi commented May 15, 2022

I understand the different behavior in React 18 and 17. #1158 (comment)

#1159 will improve the behavior, it doesn't re-render on updates. (on mount, it's double render with one commit.)

https://codesandbox.io/s/atomwithimmer-demo-forked-2cg03z?file=/src/App.js

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

2 participants