accessing the queries status triggers <Suspense>?
Hi,
Using the latest solid-query and got a question regarding its interaction with suspense:
Stackblitz repro:
https://stackblitz.com/edit/solid-vite-6v3qxx?file=src%2Findex.tsx
Basically:
How does solid-query interact with suspense boundaries of solid-js.
In this example i am accessing the queries "fetchStatus" which also seems to trigger the <suspense> boundary above.
I've set the "keepPreviousData" as placeholderdata (as per suggesstion in the upgrade-docks).
If that is not done, both bondaries trigger.
How can i achieve not triggering the suspense?
Basic setup i want to do is a searchinput with loading indicator where the results are shown below it. But i'm struggeling as everything seems to trigger the suspense ☹️
Pseudo setup:
Any Help would be appreciated
7 Replies
like-gold•2y ago
Hi @KamehamehaNudel,
If you access the query within a Suspense boundary, currently there is no way to prevent it from being triggered while data is loading. A discussion has developed in this PR. You can contribute, upvote/suggest what you think would be a good solution.
https://github.com/TanStack/query/pull/6415#issuecomment-2012138289
I would show the indicator this way:
GitHub
fix(solid-query): respect suspense: false by aadito123 · Pull Reque...
As of now, the default in solid-query is to suspend when accessing inside a suspense boundary. This may not always be ideal, hence the suspense option is provided. However, that option was not resp...
sunny-greenOP•2y ago
@Peter oh right. Thanks for the info. Didnt check the open issues.
That last suggestion actually sounds exactly like how i expected it to work. I believe it even did in v4 😅
Thanks for the suggestion, thats for sure a work around
other-emerald•2y ago
This PR has been open for a while. It seems quite a few people have this issue yet there has been no comment on it by the maintainers. Maybe I will make another PR implementing the behaviour outlined in the last comment. Hopefully that will get us some closure on whether or not they consider this an issue.
sunny-greenOP•2y ago
That would be great to be honest. It’s been very annoying to work around it
like-gold•17mo ago
This is fixed now! 🥳
https://github.com/TanStack/query/pull/7272
GitHub
feat(solid-query): Rework internals of createBaseQuery by ardeora ·...
This change aims to simplify and enhance the internals of createBaseQuery.
This change is a precursor to fix a couple of pressing issues in solid-query mentioned in
#7079
#7083
#7173
#7036
#6620
#6...
sunny-greenOP•17mo ago
Noice
Good t know it wasn’t intentional
fascinating-indigo•17mo ago
Hello! I jotted down some concerns I have about supporting the suspense false flag here. https://github.com/TanStack/query/pull/6415#issuecomment-2054120162 Would love any feedback 😄 Also happy weekend!
GitHub
fix(solid-query): respect suspense: false by aadito123 · Pull Reque...
As of now, the default in solid-query is to suspend when accessing inside a suspense boundary. This may not always be ideal, hence the suspense option is provided. However, that option was not resp...