-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Solid-Query example returns repositoryQuery.data is undefined #7507
Comments
The error I'm seeing is a different one:
|
@TkDodo apologies there was a typo in my stackblitz playground Here is an updated link without the It should match the TanQuery example: https://stackblitz.com/edit/solidjs-templates-q6qdg3?file=src%2FApp.tsx |
When you access repositoryQuery.data, the promise has not resolved yet because Suspense creates the elements immediately. You need to add a const MyComponentWithSuspense = () => {
const [profile] = createResource(async () => {
/* fetcher code here */
})
return (
<Suspense fallback={<div>fetching user data</div>}>
<div>{profile()?.name}</div>
<div>{profile()?.email}</div>
</Suspense>
)
}
The example at the top of the page using <div>
<div>Static Content</div>
<ErrorBoundary fallback={<div>Something went wrong!</div>}>
<Suspense fallback={<div>Loading...</div>}>
{/* needs the new ? */}
<div>{repository()?.updated_at}</div>
</Suspense>
</ErrorBoundary>
</div> |
Thanks for the pick up @antonio-pas I have created a PR to fix this in docs. |
Describe the bug
Solid-Query example returns repositoryQuery.data is undefined
Your minimal, reproducible example
https://stackblitz.com/edit/solidjs-templates-q6qdg3?file=src%2FApp.tsx
Steps to reproduce
repositoryQuery.data is undefined
.My guess is SolidQuery is not interacting correctly with Solid's
<Suspense>
Expected behavior
updated_at
should be displayed, or<div>Loading...</div>
should render while loading content.How often does this bug happen?
Every time
Screenshots or Videos
Platform
Tanstack Query adapter
solid-query
TanStack Query version
5.40.0
TypeScript version
5.3.3
Additional context
The example works as expected if i wrap it in
<Show when={repositoryQuery.isSuccess}>
.So my guess is SolidQuery is not interacting correctly with Solid's
<Suspense>
The text was updated successfully, but these errors were encountered: