react: Bug: react devtools TypeError: wakeable.then is not a function
React version: 18.3.0-next-555ece0cd-20230112
Steps To Reproduce
Link to code example:
https://codesandbox.io/p/github/huozhi/dynamic-suspense-forked/main
The current behavior
client throw error while hydration with react devtools opening
react-dom.development.js?ac89:14291 Uncaught TypeError: wakeable.then is not a function
at Object.markComponentSuspended (react_devtools_backend.js:5694:16)
at markComponentSuspended (react-dom.development.js?ac89:5153:1)
at handleThrow (react-dom.development.js?ac89:30749:1)
at renderRootSync (react-dom.development.js?ac89:30950:1)
at performSyncWorkOnRoot (react-dom.development.js?ac89:30465:1)
at flushSyncCallbacks (react-dom.development.js?ac89:14277:1)
at flushPassiveEffectsImpl (react-dom.development.js?ac89:31855:1)
at flushPassiveEffects (react-dom.development.js?ac89:31775:1)
at eval (react-dom.development.js?ac89:31517:1)
at workLoop (scheduler.development.js?bcd2:275:1)
at flushWork (scheduler.development.js?bcd2:244:1)
at performWorkUntilDeadline (scheduler.development.js?bcd2:551:1)
at k (preview-protocol.js:36:2929)
at Q (preview-protocol.js:36:3113)
at J (preview-protocol.js:36:3473)
The weakable variable from react_devtools_backend.js at this time is an error instance with message "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue.", then the later call of weakable.then(() => ...) will throw an error.
The expected behavior
Suepsne boundaries should be resolved successfully without error, but works with react devtools disabled
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 11
- Comments: 17 (2 by maintainers)
Commits related to this issue
- Add workaround for facebook/react#25994 — committed to GW2Treasures/gw2treasures.com by darthmaim a year ago
- fix: remove workaround for react issue (upgrading react@next) https://github.com/facebook/react/issues/25994#issuecomment-1450685077 https://github.com/facebook/react/pull/26275 — committed to mirrorz-org/mirrorz-help by SukkaW a year ago
Here is the workaround I used.
Wrap the above code in an inline
<script>and insert the script tag to your HTML, before any other script tags.If you are using Next.js, you should insert the inline
<script>tag in your_document(or in the root layout if you are experimenting Next.js appDir feature).@mondaychen I can no longer reproduce the issue with the latest
react@next, so I guess it is fixed.@SukkaW Thank you so much! @magnusriga Maybe this could help you, I’m also using the experimental app dir.
The
\ninconsole.warn(...)must be removed, otherwise, It will beUncaught SyntaxError: Invalid or unexpected tokenFacing same issue when using suspense with Sanity CMS. Disabling the react dev tool makes the error go away.
@SukkaW Sorry, I am being slow. What part of the code do I copy in where? If I replace
{ __html }, it needs to be with a JS expression, so I cannot use your full statement list.Putting the whole code into an IIFE gives me this excaption:
please check and make sure React DevTools are properly installed and that the versions of React and React-DOM match. Also, ensure that the app is running in development mode.