facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
228.61k stars 46.8k forks source link

Bug: Update hook called on initial render. #27043

Closed himself65 closed 6 months ago

himself65 commented 1 year ago

React version: 18.3.0-canary-1fdacbefd-20230630

Steps To Reproduce

1. 2.

Link to code example:

The current behavior

Uncaught Error: Update hook called on initial render. This is likely a bug in React. Please file an issue.
    at updateWorkInProgressHook (react-dom.development.js:10921:1)
    at rerenderReducer (react-dom.development.js:11188:1)
    at Object.useReducer (react-dom.development.js:12563:1)
    at useReducer (react.development.js:1760:1)
    at useAtomValue (react.mjs:51:87)
    at BlockSuiteEditorImpl (index.tsx:58:44)
    at renderWithHooksAgain (react-dom.development.js:10781:1)
    at replaySuspendedComponentWithHooks (react-dom.development.js:10728:1)
    at replayFunctionComponent (react-dom.development.js:15145:1)
    at replaySuspendedUnitOfWork (react-dom.development.js:24529:1)
    at renderRootConcurrent (react-dom.development.js:24301:1)
    at performConcurrentWorkOnRoot (react-dom.development.js:23270:1)
    at workLoop (scheduler.development.js:261:1)
    at flushWork (scheduler.development.js:230:1)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:537:1)

image

The expected behavior

himself65 commented 1 year ago

I'm trying to add a minimum reproduce code but I can't

himself65 commented 1 year ago

Related: https://github.com/toeverything/AFFiNE/pull/2989

himself65 commented 1 year ago

https://github.com/facebook/react/assets/14026360/70ee8c1c-eb9a-469a-aee5-3a2245f3f5c2

github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

github-actions[bot] commented 6 months ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!