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

React 18: Updates scheduled from useInsertionEffect #24160

Closed
eps1lon opened this issue Mar 25, 2022 · 0 comments · Fixed by #24298
Closed

React 18: Updates scheduled from useInsertionEffect #24160

eps1lon opened this issue Mar 25, 2022 · 0 comments · Fixed by #24298
Labels
React 18 Bug reports, questions, and general feedback about React 18 Type: Discussion

Comments

@eps1lon
Copy link
Collaborator

eps1lon commented Mar 25, 2022

Following up on reactjs/react.dev#4486 (comment) (/cc @acdlite )

React version: 18.0.0-rc.3-next-1159ff619-20220324

Steps To Reproduce

  1. schedule an update (e.g. setState) from within useInsertionEffect

Link to code example: https://codesandbox.io/s/naughty-bogdan-boghf6?file=/src/index.js

The current behavior

Update is applied and no warning is issued.

The expected behavior

According to https://github.com/reactjs/reactjs.org/pull/4486/files#diff-a1c8ec10dc40c86b4bbd55ad3f0126835bd45e9aa9e56c846a2e28ad6dd6acffR602 useInsertionEffect cannot schedule updates. But setState seems to "work". Maybe this is just incidental because it's the first render?

I got the impression that this should definitely cause a warning (not implemented) but I wonder if we also should consistently drop updates from useInsertionEffect?

@eps1lon eps1lon added Type: Discussion React 18 Bug reports, questions, and general feedback about React 18 labels Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
React 18 Bug reports, questions, and general feedback about React 18 Type: Discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant