T
TanStack11mo ago
multiple-amethyst

Working with providers?!

Hello everyone, I have a search bar with text input and there a mutation that fetch data from api. The state isPending reflect just there, but in the list isn't reflecting. Because until receive the response from the api I like to put loading text in the screen... https://www.loom.com/share/16e106302481497fabd94369e9404495?sid=84958822-0564-4a92-870f-0f887d29d05f
3 Replies
vicious-gold
vicious-gold11mo ago
Using a mutation that way is wrong. You want a lazy query and you can use useIsFetching for your isFetching flag(s). Either use enabled or skipToken, or call refetch() manually: https://tanstack.com/query/latest/docs/framework/react/guides/disabling-queries https://tanstack.com/query/latest/docs/framework/react/reference/useIsFetching
Disabling/Pausing Queries | TanStack Query React Docs
If you ever want to disable a query from automatically running, you can use the enabled = false option. The enabled option also accepts a callback that returns a boolean. When enabled is false: If the...
useIsFetching | TanStack Query React Docs
useIsFetching is an optional hook that returns the number of the queries that your application is loading or fetching in the background (useful for app-wide loading indicators). tsx import { useIsFetc...
multiple-amethyst
multiple-amethystOP11mo ago
Hum... isn't working, because I need to show the initial list of movies and when I search, in the list I need to show loading... and when I have the result show with the results I need understand more about this... because using isLoadingisn't working
vicious-gold
vicious-gold11mo ago
If you're filtering client side you can just use select

Did you find this page helpful?