-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(solid-query-devtools): client-side code instantiating prematurely server-side #9163
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
base: main
Are you sure you want to change the base?
fix(solid-query-devtools): client-side code instantiating prematurely server-side #9163
Conversation
@@ -1,5 +1,5 @@ | |||
import { isDev } from 'solid-js/web' | |||
import { clientOnly } from './devtools' | |||
import clientOnly from './clientOnly' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is here, importing from ./devtools
prematurely before line 6 dynamically imports it later.
@birkskyum could you please have a look? |
@@ -0,0 +1,43 @@ | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes were made here. Just moving clientOnly
to it's own file.
Bug reported here.
Reproducible example here.
User experience problem:
When using the
Tanstack Solid-Start
app, trying to use theSolidQueryDevtools
component renders[object Promise]
instead of the actual devtools UI.Technical problem:
Importing
clientOnly
from the same module as the one that's being dynamically imported (./devtools
) throughclientOnly
causes client-side code to be executed on the server-side. Particularly, thesolid-js/web
library seems to be the cause.The solution:
Simply separate the
clientOnly()
logic from thedevtools.tsx
logic. This separates concerns between each component's imports. Now the imports for devtools only load dynamically once, not twice (once prematurely) through importing clientOnly from the same file.Before UI
After UI