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-gold6/21/2023

Does `setQueryData` really re-renders component?

Hey, im struggling with very similar issue, and I don't understand why it works with native useState but not with setting query data manually as optimistic update" https://github.com/bjornhenriksson/dnd-react-query-problem
unwilling-turquoise
unwilling-turquoise6/21/2023

is prefetchQuery the singular form of refetchQueries? when should I use each?

say, on a mutations onSettled callback. If i know a query I want to refetch then and there, should I use prefetchQuery or refetchQueries? And also - if my staleTime is 0 (i.e - the default), is there any other benefit to refetching, rather than just querying when it's rendered / active? say im fine with the stale cache being there for a moment, can I just not worry about it?...
absent-sapphire
absent-sapphire6/20/2023

Enabling abort on unmount

The docs say "By default, queries that unmount or become unused before their promises are resolved are not cancelled". How do I configure that? I'm looking all around the docs for a list of options/configs and am finding nothing except a list of important ones.
equal-aqua
equal-aqua6/20/2023

QueryCache not being updated after a successful mutation

I’m posting a new todo to a json placeholder. Now the mutation is successful and server state gets updated with the new todo. But even after invalidating queries in onSettled, refetch returns the old todos. Please help me with this as I’ve been losing mind over this for past couple of nights...
No description
harsh-harlequin
harsh-harlequin6/20/2023

Question about the best way to paginate and filter an API request

Guys, I believe you can help me 🙂 I am having trouble to understand what's the best way to fetch a request based on: An API which can be paginated and filtered based on some query parameters. Neither of those are query keys (pagination and query parameters), so I storage my pagination and query parameters in React State. When the user changes some of those, it should trigger the query refetch inside useEffect....
rising-crimson
rising-crimson6/20/2023

app bot found on page refresh

Hi I have my app with react router with a basename but on refresh it doesn’t found the page and throws a blank white page. How fix it ?
afraid-scarlet
afraid-scarlet6/20/2023

Is using 'useCallback' inside 'select' option a good pattern?

I saw somewhere that useCallback should be used inside an expensive select ```js const { data } = useQuery({ queryKey: ["myKey", { id }],...
exotic-emerald
exotic-emerald6/20/2023

Is it possible to stop a query refetch based on query data?

I want to implement a polling function that polls a video's transcript every second while it's processing so that it "immediately" updates the UI when it's ready. This is what I have so far: ```ts const transcriptQuery = useQuery({ queryKey: ["transcript", selectedAsset?.asset.transcription.id],...
genetic-orange
genetic-orange6/19/2023

Running a query on an interval then updating the cache based on the response in an onSuccess

``` useQuery({ refetchInterval: 2000, enabled: status === Status.PreparingUat, queryKey: ["getUatStatus", id],...
adverse-sapphire
adverse-sapphire6/19/2023

Failed to resolve entry for package "@tanstack/solid-query" when upgrading to solid-query 5.0.0

Working on migrating a demo project. Everything seems installed correctly (Typescript is happy and I can navigate to the package in node_modules). But getting this error (using Vite to build with the solid template)
optimistic-gold
optimistic-gold6/18/2023

TanStack Query makes next.js freeze

Hi Folks Anyone facing some issues with next.js 13.4 app router when i go to some page in my blog that has anything related with Tanstack Query makes the page freeze. here is the scenario that i found ...
rare-sapphire
rare-sapphire6/17/2023

Unable to use solid-query 5.0.0-alpha.66 with Astro

6:07:12 AM [vite] Internal server error: Failed to resolve entry for package "@tanstack/solid-query". The package may have incorrect main/module/exports specified in its package.json. Plugin: vite:import-analysis 5.0.0-alpha.62 however can be imported just fine, though I need some of the bug fixes in the latest version....
ratty-blush
ratty-blush6/17/2023

Example http request with axios and react-query

Hi, can anyone suggest me a hook to handle http requests with axios and react-query?
foreign-sapphire
foreign-sapphire6/16/2023

Why is queryKey type in QueryOptions possibly undefined when it is a required parameter

In the API docs queryKey in the options object from useQuery() is marked as required yet in the interface for QueryOptions it is defineed as possibly undefined, any reason for this?
optimistic-gold
optimistic-gold6/16/2023

Tanstack Query Pagination SEO

Hi guys I have questions it might oot but hopefully it is fine, so i try to build personal blog using nextjs 13.4 app router. i already implement the pagination with help of tanstack query, but i have a concern regarding the SEO. 1. i know using tanstack query for pagination makes my blog became client side rendering, but how much it will be affecting my SEO?...
optimistic-gold
optimistic-gold6/16/2023

Prefecth in Next.js 13.4 app router is not working

Hi Guys Previous post/issues that i was having (https://discordapp.com/channels/719702312431386674/1118803621203681301) is solved now, and now the error is not present anymore. but now i have another problem, although i already implement the hydrate, this still not working and the prefetch is not firing....
No description
quickest-silver
quickest-silver6/16/2023

Use cache as store with some computed logic and graphQL structures

Hello all! I'm trying to use react-query cache as the frontend store (to avoid using both zustand and react query) I'm facing two issues: 1) How to make it work with graphQL-like stuff...
rival-black
rival-black6/16/2023

Why doesn't random value work here but static does?

Here's the code ```jsx const getRandomId = (numbers: Number[]) => { return Math.floor(Math.random() * numbers.length) }...
xenial-black
xenial-black6/15/2023

I can't, for the life of me, get `getPreviousPageParam` to work

I'm trying to use useInfiniteQuery to create a simple paginated component that shows the results of the CURRENT page and allows to paginate back and forth with left/right buttons. My REST API (DRF) is using the limit/offset approach rather than page/size, which may be related to the issue I'm having. To speed things up, I created a wrapper hook that simply allows me to specify the base URL and take care of the rest. Here's the code: ```ts...
other-emerald
other-emerald6/15/2023

What's different with HTTP Cache and React Query ?

My backend engineer ask me this question. I don't know how to reply. anyone can give me a favor, what's the benefit about React Query?