Best practices for large-scale offline-first app with useLiveQuery + state management ? #5135
Replies: 2 comments 1 reply
-
|
Hey! I was wondering if you migrated to Tanstack Query. If so, how's the performance? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @jonathan-pyt :D Chiming in here because we're running a very similar stack (Expo + Drizzle + SQLite, offline-first; I'm from Iran. The government here cuts the internet, and we have critical issues connecting to the network. VPN prices are skyrocketing. offline-first is mandatory) and have hit the exact same pain points. Wanted to share what's worked for us since it sounds like you're at the same crossroads and let me try my best to give it the response it deserves.
This gives us the live reactivity of
What I'd recommend trying before a full migration:
Happy to share a gist of our (+ Sorry for bad english, hope it makes sense.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Stack:
Context:
SQLite is our single source of truth. We use useLiveQuery with some additions like debounce and enabled options to make it more manageable.
One issue we've encountered with Expo Router: when navigating between stacks, components aren't unmounted — they stay in memory. This means live queries keep running in the background across different stacks, listening for changes and re-executing even when the screen isn't visible. We've had to manually handle this with the enabled option based on focus state, which adds boilerplate.
The Problems:
As the app scales, we're hitting friction points:
Considering React Query:
We're thinking about migrating to React Query for:
But we'd lose the automatic "live" reactivity that useLiveQuery provides.
Questions:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions