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

afraid-scarlet
afraid-scarlet12/6/2022

invalid

Attempted import error: 'useRef' is not exported from 'react' (imported as 'React').
inland-turquoise
inland-turquoise12/6/2022

Pagination + Filter + Sort

I'm currently making a forum site and I want to be able to query posts with pagination (so something like useInfiniteQuery so they all don't load at once) but also support filtering the title by text as well as sorting by a certain column. I was wondering if this is possible to do in React Query and would I have to make multiple different API endpoints? (Currently using Prisma on the backend)...
plain-purple
plain-purple12/5/2022

need help in nested grouping react-table

I am trying to create a nested grouping table. need help
automatic-azure
automatic-azure12/4/2022

How can i fetch query inside a loop and push back data for each iteration?

Exmaple: ``` const ids = useQuery({ queryKey: ["ids"], queryFn: () => fetchIds(),...
foreign-sapphire
foreign-sapphire12/4/2022

Query not updating after mutation

So I have an endpoint that fetches a single artwork, within that component, I need to upload images to that single object but after firing the mutation, it does not update in real time, I believe there is something I may be doing wrong, Will appreciate a second look at my code to assist me. Thanks in advance @TkDodo 🔮 ...
other-emerald
other-emerald12/3/2022

Using prefetch query in getserversideprops (next.js) fails when deploying on Vercel

Hi everyone, my code in running in local but when I deploy it on Vercel it fails - I prefetch the async moralis code with react query in getserversideprops - I retrieve it and console.log shows undefined when I deploy this code, but one more time everythings works fine locally when I run pnpm dev what I'm doing wrong ? Is this even the right way to do this ?...
No description
helpful-purple
helpful-purple12/3/2022

How to prevent data from sorting after refetch

Hi, i have a function to like a specific publication that i'm using as ```export const useUpdatePost = () => { const queryClient = useQueryClient(); return useMutation((payload: any) => updatePost(payload), {...
stormy-gold
stormy-gold12/2/2022

Does the `useQuery` caching against the `queryKey`?

I have this snippet and I'm expecting that the endpoint will requested any time the prunedFilter is changed as it is changing the key. * This is actually first expectation what failed, so I'm calling the refetch in the useEffect hook to achieve this behaviour. * Other expectation I have is that the endpoint will requested against query key, so if the changed prunedFilter will change back to previous state and therefore, the key will appear same as before, I'm expecting cached data, but it's requesting the server any time the prunedFilter is changed....
quickest-silver
quickest-silver12/1/2022

Prefetch Query error - Next.js

Hi everyone. I'm currently have this error when try prefetch a query on getServerSideProps. This is my code: ```ts export const getServerSideProps: GetServerSideProps = async (ctx) => {...
No description
genetic-orange
genetic-orange12/1/2022

Will it fetch multiple time in this example ?

I have an endpoint that sends me a big object (ex: all posts + all messages). I'd like to fetch only once and compute only once derivated data. I'm thinking of creating multiple hooks: ```js const useAllPostsAndCommentsQuery = () => useQuery( ["posts"],...
evident-indigo
evident-indigo12/1/2022

Long running query saving to wrong query key

Hi, Having a particular issue and I thought I'd pick the brains of the lovely people here. So I am kicking off a long running query with the following query key: ["studies", connectionId1, [page1, page2]] <-- KEY1...
eastern-cyan
eastern-cyan11/30/2022

Jest test finishing before onSuccess of useMutation is executed

Hi all, We are having trouble with our react component test that relies on data being re-fetched after a mutation. useMutation()...
wise-white
wise-white11/29/2022

Getting status integrating react-query with react-router loaders

Hey, hope you're doing well. I've faced an issue while using react-query with react-router loaders. I've seen the example https://tanstack.com/query/v4/docs/examples/react/react-router. The issue is we can't have the query 'status' where we're using useQuery & it's always in 'success' state. ...
correct-apricot
correct-apricot11/29/2022

Error No QueryClient set, use QueryClientProvider to set one

We created a Next.js App and wanted to use the generated function from the backend. To generate the functions we use orval and they are published in a npm repository as we don't use a monorepo. But now we are getting this Error, but we added the QueryClient to the _app.tsx. Here is the example where the error can be reproduced: https://github.com/schoolutilities/react-query-example Has anyone an idea why this error occurs?...
deep-jade
deep-jade11/29/2022

Edit React Query Data

Is it possible to edit the data which lies in react query much like you can do it through the browsers developer/inspect tool if the data is stored locally or in a session?
inland-turquoise
inland-turquoise11/29/2022

Unexpected re-renders, notifyOnChangeProps question

Hi, i have a question about notifyOnChangeProps. Docs says that the default behavior is tracked, but I see some unexpected re-renders and I'm trying to understand why they are happening. Please take a look at this example: https://codesandbox.io/s/quizzical-montalcini-jm2dyf?file=/src/index.js ...
No description
robust-apricot
robust-apricot11/28/2022

No QueryClient set, use QueryClientProvider to set one (yarn workspaces)

Hello, I've a monorepo build with yarn workspaces, I've a components workspace that contains all my shareables components and another workspace that contain the APP. I've install the react-query library as a dependency in the app workspace and set it up as peer dependency in the component workspace...
extended-salmon
extended-salmon11/28/2022

one Query with many dependencies vs many Queries

Hey guys, just started using react query and i am not sure regarding this using nextjs 12 (SSG) with hydration: - blogOverview that can filter by tag via api and via search params. Initially I want to load the data during build (no tags, no search): ```...
helpful-purple
helpful-purple11/27/2022

Error vs isLoading

Hello, is there a way to hold onto the error, ie keep displaying the error message even during a subsequent isLoading? In our situations where errors are thrown they're usually persistent so it's very confusing to oscillate between loading and the error state. Thanks!