Enabling offline mode with the t3 stack

I'm using the t3 stack with trpc and prisma. The application I'm building is for use on construction sites who need a cached version of their data when their wifi is patchy. I want to keep using the stack i'm currently using but let users have access to their information if the wifi is sketchy which syncs to the database when wifi is established. The application doesn't hold alot of data - maybe 50-200 rows of 2-3 sql tables. Options I've considered 1. Using the persistance features in client state management libraries (e.g. zustand) 2. Using a tool that keeps a local SQLite db in sync with a server db e.g. WatermelonDB, ElectricDB, powersync The first option seems straight forward but will need some custom code to manage the sync when wifi is re established - the second looks more fit for purpose but requires I drop prisma and use the libraries ORM or raw SQL (I'm not comfortable dropping prisma) Thoughts?
1 Reply
Rigrig
RigrigOP10mo ago
Setting up tanstack query network mode to offlineFirst was shared as an option in another similar thread https://tanstack.com/query/latest/docs/framework/react/guides/network-mode
Network Mode | TanStack Query Docs
TanStack Query provides three different network modes to distinguish how Queries and Mutations should behave if you have no network connection. This mode can be set for each Query / Mutation individually, or globally via the query / mutation defaults. Since TanStack Query is most often used for data fetching in combination with data fetching l...
Want results from more Discord servers?
Add your server