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

multiple-amethyst
multiple-amethyst9/18/2022

Query parameter based on another useQuery

So, I have two useQuery calls, the first one gives me an id, I insert that same id into the second useQuery function so that it will get passed as a query parameter, however, since it's initially undefined, the request that fires has the query parameter as undefined, console.log also logs undefined first and then the correct value, how do I get around this? ```js const { data: users } = useQuery(["users"], () => getUsers(), { select: (data) =>...
helpful-purple
helpful-purple9/17/2022

What prompts `useQuery` to refetch?

When using useQuery, does it automatically detect (with query keys) whether or not it should refetch again? If I have a useQuery at the top of a component, it will fetch when the component is rendered. If the component is re-rendered, would it fetch again? Or it would check first if the data in the cache is stale, and if so, it will only refetch then. Is this the case?
multiple-amethyst
multiple-amethyst9/17/2022

PUT request with controlled form

Hi, I don't know how to perform a PUT request with RQ, everything I found indicates use of React Hook Form, whereas the project I am on doesn't have it, how would I be able to insert the values into useState so that I can put them inside an input's value prop and update them with PUT
provincial-silver
provincial-silver9/17/2022

React Query SSR with NextJS

Hi guys, I need some help. I'm using React Query with NextJS and I want to cache data returned from a call on one page when visiting another page of my app, so that my API is called only on the 1st page Here's my app setup: ``` const [queryClient] = useState( () =>...
metropolitan-bronze
metropolitan-bronze9/16/2022

Wanted to get an opinion on my Query Keys

To get good at react query I am building a simple task management tool which has journeys. A journey is made up of stages and stages are made up of tasks. I was thinking of using the following query keys - 1. Query to get the journeys
["journeys", workspaceId]
["journeys", workspaceId]
2. Query to get a specific journey...
conscious-sapphire
conscious-sapphire9/16/2022

Best patterns for initializing form data from a query

The pattern I've typically used is some container component is the launching point for a form. It has a list of data and the user clicks on one to edit it, which navigates to a form (modal or another page, whatever). The way I manage this logic is usually something like this ```ts const query = useItemsQuery(); const [selectedItem, setSelectedItem] = useState<Item | null>(null);...
stormy-gold
stormy-gold9/16/2022

Query Key factory best practice for filters

Is it ok to keep query key in this format? in here we have used a single key called sortCriteria to keep pagination and filter information. Or is it more advised to create separate keys for each filter keys(more flattened)? Current: ```json...