TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

šŸ“£-announcements

optimistic-gold
optimistic-gold2/8/2023

Is there a way on react-query to trigger all my fetch upon refresh?

after rigger fetch app can only trigger each fetch depends onFocus screen?
flat-fuchsia
flat-fuchsia2/8/2023

Invalidate all queries when a certain query runs?

Is there a patter for invalidating all queries when a query with a certain key changes?
unwilling-turquoise
unwilling-turquoise2/8/2023

`suspense: true` is not triggering Suspense

Hello, In my codebase I have the following code: ```...
mute-gold
mute-gold2/7/2023

useInfiniteQuery save objects individually

I am using useInfiniteQuery to implement a flatlist with posts of my app. Each page of useInfiniteQuery fetch 15 posts. Its is possible to save each post individually in a query like ```js...
ratty-blush
ratty-blush2/7/2023

No matter what the individual queries cacheTime, the query will be persisted with default cacheTime

from the question below I found that the answer has to do with the query always being persisted with the default queryClient values. Is this desired behavior?
ratty-blush
ratty-blush2/7/2023

Don't refetch if there is data in the query cache

My goal is simply to not refetch a query if there exists data in the queryCache. I am using a PersistQueryClientProvider which is successfully using the persisted query client from local storage when start the app. However, if there is data in the local storage related to that query I want to disable refetching on mount and in general....
stormy-gold
stormy-gold2/7/2023

What is the proper way of making a protected page with react-query?

Greetings all, I have a next.js app in which I need to protect a specific page and show it users only if they have a certain "status" which is fetched through a simple query to the server. See this code example for reference: ``` import React from "react"; ...
other-emerald
other-emerald2/6/2023

What would be the best way to get multiple mutations statuses?

Hello šŸ‘‹ What would be the best way to get multiple mutations status? similar to useIsMutating(filters) ...
conscious-sapphire
conscious-sapphire2/6/2023

List all "in progress" queries -- is this possbile?

I'm looking for a way to view and list all in-progress queries that the QueryProvider is currently running. Is there a way to do this?...
deep-jade
deep-jade2/4/2023

Using previous stale data while refetching

How do you deal with data while fetching, it seems that while the refetch is happening, the data is undefined, unless you use placeholderData/initialData. Is it possible to return placeholderData during the first fetch only, and the previous stale data after that while refetching? Currently the placeholderData is shown during every refetch which messes with animated transitions between the data values....
fair-rose
fair-rose2/4/2023

useMutation (onMutate) is missing.

Hello.. I was using useMutation and created a reusable function as you can see on the left hand side of the image. Now, when I use that function on the right hand side of the image I haven't get any onMutate options. What did I miss here? Thank you.
No description
genetic-orange
genetic-orange2/3/2023

useQueries with infinite queries

I am rendering a dynamically generated tree (e.g. file browser), where every tree node is fetched from an API (I.e. I don't know how many root nodes I will start with, or how many children each node will have). The implementation is more or less like this: ```ts // useTree hook const [openNodeIds, setOpenNodeIds] = useState([]);...
wise-white
wise-white2/3/2023

Less hacky way to do a simple filter (sandbox code included)

I want it to fetch on the first loading, and if the user wants to search something, filter from the loaded data. This is the way I made it work, but I feel i'm not using fully react query. https://codesandbox.io/s/trusting-hill-fvq8qe?file=/src/App.js...
magic-amber
magic-amber2/3/2023

Creating a Wrapper hook over useQuery in Typescript

Hey I’m trying to implement something like this const { useQuery } = require("react-query"); ...
sunny-green
sunny-green2/2/2023

React-Query v3 Can't get results to be returned when using Vitest with MSW

Hi everyone, So I'm in the process of upgrading my projects test suite to Vite and I've noticed that when trying to test the data fetching hooks that when I now return the data nothing is returned resulting in the tests failing (See attached image 1) When the hooks are used outside of the testing environment then the hooks work perfectly fine as far as I can see, so it's an issue in testing land. I've got to be missing some configuration or something as they were working fine when using jest with react-scripts but now I've introduced vitest and vite it's now misbehaving....
No description
conscious-sapphire
conscious-sapphire2/2/2023

Using the exact useQuery() hook multiple times in sibling components.

Is it fine to call the exact same useQuery() hook in multiple sibling React components ? Or is it a bad practice and I should call useQuery() only once at the parent component and pass the data into the children components ?
magic-amber
magic-amber2/2/2023

React native Error "No QueryClient set, use QueryClientProvider to set one"

Hey, i am having a problem with React Native integration of tanstack react query. Here is my code: ``` import * as React from "react"; ...
foreign-sapphire
foreign-sapphire2/2/2023

axios vs. fetch api

I saw a lot of examples are using fetch api, and wonder if this can completely replace axios? What are pros and cons for each? I'd like to have one less library to maintain, so I'd like to know if axios has something fetch api can't do. Thanks!
causal-orange
causal-orange2/1/2023

How to trigger validation schema of formik from another component?

How to trigger validation schema of formik from another component?
automatic-azure
automatic-azure2/1/2023

Remove query once logged out

I am having problem on how to remove a query that gets a user data once logout. I want to find a way to force a reload/refetch when I log in as the previous data is shown for a second before changing the details of the new user and is not great. Below my logout logic in mobx store to delete the token...
No description