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

stuck-chocolate
stuck-chocolate8/12/2025

Taking params via quercollection options

Is there a best way to do this or am i thinking about this wrong? for context, i want to make a collection for session messages, on updates i'll probably end up using your writeBatch function to avoid refetches. however how would i go about the queryfn in an approach like this? sorry if this is a newbie type of question, i usually like deep diving on docs but they aren't there yet and im sure we've got some pros in here...
helpful-purple
helpful-purple8/7/2025

createOptimisticAction rollback too returning in the mutationFn does nothing

and onUpdate handlers doesnt fire ```ts export const updateRating = createOptimisticAction<{ id: number, rating: number...
helpful-purple
helpful-purple8/6/2025

collection insert rollback instantly

perhaps doing it wrong but when i click on insert the data do ``` [{"id": 1}] [{"id": 1}, {"id": 2}] [{"id": 1}]...
conscious-sapphire
conscious-sapphire8/1/2025

Is collection schema just for type inference, or is it leveraged internally for other operations?

Do I gain anything by adding a schema to a collection when my api already returns typed responses?
conscious-sapphire
conscious-sapphire8/1/2025

Best practice suggestion: Should I avoid mapping over api data?

A lot of my useQuery hooks are mapping over api response to shape the data nicely for frontend consumption. My hunch is that I should generally avoid doing this and do the massaging in the select of a useLiveQuery or pure function instead of altering the data shape of whats going to the db. Pls confirm/deny/refine my hunch 🙂 Example Before...
conscious-sapphire
conscious-sapphire8/1/2025

Best practice suggestion: Should I strip pagination information?

A lot of my queries include pagination information. Assuming I'm able to get all of a thing from my api, should I change the response to strip the pagination meta when returning to a collection? ({ total: data.total, items: data.items }) --> data.items...
conscious-sapphire
conscious-sapphire8/1/2025

is a live query collection just an alias for a regular collection?

maybe im overthinking this. say i have ```ts const usersCollection = createCollection( queryCollectionOptions({ id: "users",...
fair-rose
fair-rose7/31/2025

Pattern: Populating a collection "as needed" with multiple Queries throughout app - no "base" query.

This thread explores using various useQuery hooks throughout the app to "feed" our collections, only adding records as they're called for throughout the app. We don't want to force the user to load entire db tables since 95% of the time they will only use a small % of them. We do want to progressively build up a store and use it's querying methods to performantly select from the data that has been fetched. As of 7/31 we have "manual sync update methods" per this issue: https://github.com/TanStack/db/issues/294...
foreign-sapphire
foreign-sapphire6/2/2025

Syncing Paginated Rest API

Is there a recommended pattern for syncing a paginated rest API? The example in the docs for an API assumes all items are returned in a single request. I have some ideas, and I know the answer is highly depended on how your API works, but any examples would be helpful to make sure I'm going about it in roughly the right way....
frail-apricot
frail-apricot5/19/2025

Questions about Purpose

I respectfully would like to make sure I understand the value add of this library because I find it super interesting and I may actually use it to speed up some deeply nested stuff I'm doing in a menu builder app, here are some questions I have... 1. If I'm building something with TanstackDB is the assumption that I fetch all my data for a user up front in flat arrays rather than nested data structures, that way I'm doing my joins on the frontend and can keep things more performant? For example, in my current app, I fetch nested data for a Restaurant that looks like this (it's way more complicated in practice)...
No description