Destructuring `createQuery` attributes causes my code to stop working
I am wondering if an issue I am dealing with is a problem with my code or the package:
Let's say I have the following code in the
script
tag of my component:
The code above works fine, when the data is available, it will render everything properly on the screen however if I try to destructure, like below:
The code stops working. By "stop working" I mean: it fetches the data (as I can see the JSON retrieved from the external API in the console), but it does not render the information on the screen, as if the package is uncapable of identifying that the data is now available.
Let me know if you need the full code.
Edit note:
Here is the implementation of useGetAllProducts
:
3 Replies
equal-aquaOP•5mo ago
https://github.com/TanStack/query/discussions/7413#discussioncomment-10154514
I am using the preview build of Svelte Query for Svelte 5
GitHub
Svelte 5 Support · TanStack query · Discussion #7413
I'm wondering what is left to support svelte 5 and if the current approach is good. A lot of Svelte 5 apps are blocked so just trying to get a consensus of where community can help. #6981
equal-aquaOP•5mo ago
Solution:
wrap it on a
$derived()
A quick warning:
This will call useGetAllProducts
method infinitelycloudy-cyan•5mo ago
New build will be coming out soon, which may fix this!