T
TanStack16mo ago
useful-bronze

Suspend with query data from external promise

I'd like to do something like the following repro: - Create a query in a component - Fetch query data in some promise outside of the createQuery - Use that promise as the next result for the createQuery - Cause the createQuery to re-suspend while waiting for the promise to resolve - Have the re-suspension happen during a transition so that isPending becomes true The last 2 are the really tricky parts I've tried using removeQuery, clear, and setQueryData to get rid of the cached data to try and make the createQuery re-suspend, but the former 2 options actually cause the createQuery to unsubscribe from the query cache entirely (observed by seeing the 'observers' count for the query become 0 when either of those functions are used). @Aryan Is there even a way to go about this? Considering that each createQuery maintains its own local cache of the data I wouldn't be surprised if the final point about the transition is even possible.
StackBlitz
Solidjs - Templates (forked) - StackBlitz
Vite + solid templates
2 Replies
stormy-gold
stormy-gold16mo ago
Hello! I'm not sure I understand what is the expected behavior. If you trigger a change inside a startTransition, wont it hold the downstream updates and prevent any dependent suspense boundaries triggering? Is there a scenario where you can trigger a transition and also suspend a downstream suspense boundary with vanilla SolidJS?
useful-bronze
useful-bronzeOP16mo ago
I think we're talking about the same thing, but the way I'd describe transition behaviour is that a transition will only 'hold the downstream updates' if an existing suspense boundary triggers. If no suspense boundaries trigger then the transition has no reason to block

Did you find this page helpful?