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

absent-sapphire
absent-sapphire10/10/2025

Long term persistence strategy

What is the best way to use TanStack DB so that the local content is preserved across sessions and tabs? Scenario - 40 MB of data needed from DB to operate offline (approx.) - Re-downloading this every time is expensive. Ideally, data stored on device is used first and updates since last sync are applied...
absent-sapphire
absent-sapphire10/10/2025

Electric Replica Identity

electric-1 | 00:32:34.930 pid=<0.3276.0> [error] Schema reconciliation failed: ** (Electric.DbConfigurationError) Database table "public.users" does not have its replica identity set to FULL
electric-1 | 00:32:34.930 pid=<0.3276.0> [error] Schema reconciliation failed: ** (Electric.DbConfigurationError) Database table "public.users" does not have its replica identity set to FULL
just wondering if there are plans to support non-full (ie default) replica identities in the future? or is this requirement by design?...
harsh-harlequin
harsh-harlequin10/6/2025

How to wait for 'clean' queryCollection

This is related to this scenario here: https://discord.com/channels/719702312431386674/1369767025723052134/1423904416272089089. I'm creating a row if it does not already exist. If it does exist, the API will return an error, and the desired behaviour is that it refetches to sync with the query state. However, at this point the change gets reverted, triggering the same mutation to run again. I'm wondering if there's a way to wait for the collection to be 'clean': that is that there was a refetch and no errors occured since....
evident-indigo
evident-indigo10/5/2025

Best practices for Infinite lists with TanStackDB

Hey guys, sorry if this question has already been answered but I haven't found anything concrete in discord history. Is there a best practice solution for implementing an infinite list with TanStack DB and electricSQL? Based on my reading, it looks like there isn't a TanStackDB liveQuery that is similar to useInfiniteQuery .I'm going to use orderBy, limit and offset but is there anything else you'd recommend when implementing an infinite list with TanStackDB?...
extended-salmon
extended-salmon10/4/2025

question about persistance

Does the default electric sql collection has indexdb based persistance support by default? I am seeing that it syncs everything from server on every page refresh and uses nothing from local. Can someone please clear this doubt?
dependent-tan
dependent-tan10/4/2025

`await tx.isPersisted.promise` is not working

I've been using tanstack/db for about a month now, and the await tx.isPersisted.promise has stopped working at some point. I don't remember which version, but I'm currently on 0.1.27 and it doesn't work....
No description
xenophobic-harlequin
xenophobic-harlequin10/3/2025

Tanstack Query Dependencies

Hello, I've been wanting to use Tanstack DB in my project which also uses Tanstack Router and Tanstack Query, but I've been struggling to figure out how to structure createCollection with queries that have a dependency on a different query. In particular, I use versioned endpoints to manage CDN caching, so most of the queries I want to use to create collections depend on a db-version query which has to run before them. This creates a problem since it seems like collections really want to be defined in the global namespace (so they can be used directly inside live queries), but it isn't possible to encapsulate this dependency chain with queryCollectionOptions since there's no way for the db version to get passed from the db-version query into the statically defined query inside queryCollectionOptions. ...
foreign-sapphire
foreign-sapphire10/3/2025

type narrowing in live queries

Hey all! I've got a series of events which I'd like to filter out (and type narrow) in order to produce aggregates. Here's what I have so far: ```typescript export const eventCollection = createCollection( localOnlyCollectionOptions({...
absent-sapphire
absent-sapphire10/3/2025

Safari refusing to use HTTP/2

Bit of a long shot but if anyone has any ideas, please let me know... I have a tanstack start/db/electric sql setup with an API proxy from the start server -> electric sql, and caddy reverse proxying the start server. Caddy is serving an internal tailscale domain (ts.net) as the route for my dev server, which means it gets HTTPS automatically. On desktop firefox and chrome this setup is enough to get even http/3 connections, while safari on desktop and iOS are refusing to use anything except 1.1, which leads to the now-familiar 6-connection limit issue. If anyone has any ideas please let me know! I suspect tailscale somehow has smth to do with it but I have no other leads....
foreign-sapphire
foreign-sapphire10/1/2025

typing in helpers in db-ivm

Hey! I'm using db-ivm to aggregate events from an event-sourced system for display. Working great so far! I've noticed a lot of boilerplate around sorting and filtering, though, and so I've tried to make myself a helper: ```typescript export function build<Event extends { timestamp: number }, Out, Key extends string | number>( builder: (events: Event[]) => Out | null | undefined,...
absent-sapphire
absent-sapphire9/29/2025

Understanding how temporary IDs are used

I've got a function like ``` export function generateTempId(): number { return -Math.floor(Math.random() * 1000000) + 1...
correct-apricot
correct-apricot9/26/2025

Creating multiple collections from a single query?

Hiya folks! I'm curious: we're looking at adding batched rpc routes for a given page that return all data required to render said page in a single request. Is there a way to create/update multiple collections from a single query?
typical-coral
typical-coral9/17/2025

Is it possible to keep SSR on in TanStack Start when using TanStack DB?

```tsx export const Route = createFileRoute("/stuff/")({ ssr: false, component: RouteComponent, });...
ambitious-aqua
ambitious-aqua9/16/2025

Hitting issues updating an item in collection

```tsx export const createConversationThoughtsCollection = ( conversationId: string ) => { return createCollection(...
ambitious-aqua
ambitious-aqua9/15/2025

Best practices on keeping multiple electric connections active

Hey there I was planning on having everything sync'd at login by having a Provider that calls all liveQueries so that it will always have a sync connection. That being said, my normal requests weren't going out. I removed the provider and the normal REST requests started going out again. Is this a limitation on android? Should I not have a provider wrapped around my app? I'm not concerned about server bandwidth for having 5 active request per open app, but it seems normal rest API requests are being prevented from firing PS- I'm using this w/ React Native...
No description
genetic-orange
genetic-orange9/14/2025

Collection errors are not trackable without calling useLiveQuery

If I check collection.utils.errorCount() in a component that won't use a live query hook, the collections error utils won't trigger a rerender. It's a bummer because I'd like to be able to check if a collection has errored in a child component, and I don't want to subscribe to a live query in the parent as it adds 10-15ms to the render duration of the parent component. This tiny delay makes the children optimistic updates feel much less snappy...
genetic-orange
genetic-orange9/13/2025

Is a single item collection a valid pattern?

Hi! I really love the benefits that DB brings on top of Query. Especially the optimistic updates! However, I’ve been struggling to understand the mental model around single item collections, like user data. Should I create a users collection with a single item, and wrap the returned data from queryFn into an array to conform to an array? ...
provincial-silver
provincial-silver9/13/2025

Zombie Effect

Has anybody else experienced page hang when navigating quickly between two routes that both use the useLiveQuery hooks? Tanstack router registers the route change, the url changes, but the page content does not change? When the useLiveQuery hook is not being used in the route, then this issue goes away....
continuing-cyan
continuing-cyan9/13/2025

are collections meant to be singletons?

Hi friends, Just getting my feet wet here and thinking about the multi-tenant use case where we might want to have a query function that, for example, fetchs todos for a specific organization. ```...
like-gold
like-gold9/9/2025

unique index does not throw DuplicateKeyError

Maybe I'm misunderstanding how it should work but I'm trying to handle duplicates on the client to faster feedback. I have added an index to my collection and it correctly deduplicates the data, however my insert just fails silently now ```ts ratelimitOverrides.createIndex((row) => [row.namespaceId, row.identifier], {...
Next