Skip to content

fix(solid-query-devtools): client-side code executing on server, breaking UI #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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wlemahieu
Copy link

@wlemahieu wlemahieu commented May 19, 2025

Bug reported here.

Reproducible example here.

User experience problem:

When using the Tanstack Solid-Start app, trying to use the SolidQueryDevtools 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) through clientOnly causes client-side code to be executed on the server-side. Particularly, the solid-js/web library seems to be the cause.

The solution:

Simply separate the clientOnly() logic from the devtools.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

Screenshot at May 18 21-02-42

After UI

Screenshot at May 18 20-54-14

@wlemahieu wlemahieu changed the title separate concerns of clientOnly and SolidQueryDevtools Prevent client-side code from executing on server May 19, 2025
@wlemahieu wlemahieu changed the title Prevent client-side code from executing on server fix(solid-query-devtools): client-side code executing on server, breaking UI May 19, 2025
@@ -1,5 +1,5 @@
import { isDev } from 'solid-js/web'
import { clientOnly } from './devtools'
import clientOnly from './clientOnly'
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant