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

fix: react async import mode #185

Merged
merged 1 commit into from
Mar 15, 2022
Merged

fix: react async import mode #185

merged 1 commit into from
Mar 15, 2022

Conversation

shkreios
Copy link
Contributor

Issues

Currently, using react with async import mode throws this error

react-dom.development.js:13231 Uncaught Error: Objects are not valid as a React child (found: object with keys {$$typeof, _payload, _init}). If you meant to render a collection of children, use an array instead.
    at throwOnInvalidObjectType (react-dom.development.js:13231:15)
    at reconcileChildFibers2 (react-dom.development.js:14133:7)
    at reconcileChildren (react-dom.development.js:16990:28)
    at updateContextProvider (react-dom.development.js:18699:3)
    at beginWork (react-dom.development.js:19111:14)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
    at invokeGuardedCallback (react-dom.development.js:4056:31)
    at beginWork$1 (react-dom.development.js:23964:7)
    at performUnitOfWork (react-dom.development.js:22776:12)

Solution

React.lazy returns a component not a React element therefore the returntype of React.lazy needs to be invoked either by jsx or React.createElement.

@shkreios
Copy link
Contributor Author

I am not familiar with solidjs maybe the async import implementation also needs to be updated.

@hannoeru hannoeru changed the title fix: update react async import mode fix: react async import mode Mar 15, 2022
@hannoeru hannoeru merged commit 7c8f4b9 into hannoeru:main Mar 15, 2022
ckangwen pushed a commit to charrue/vite-plugin-pages that referenced this pull request Jan 24, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants