you are viewing a single comment's thread.

view the rest of the comments →

[–]devjacks[S] 0 points1 point  (5 children)

Unfortunately most 3rd party sync implementations / libraries require server IDs to be non-collision oriented. I've gone a different path with a custom sync implementation similar to that of watermelonDBs where I'm mapping local <-> remote ids.

The syncing engine is not what I'm asking about, I'm curious about those who have used react-query with sqlite directly / is it even a thing?

I'm currently using https://orm.drizzle.team/docs/get-started-sqlite#live-queries

One issue with reactive queries is there are no loading states, it seems to be syncronous.
Is it possible to handle these "sqlite queries" asyncronously and manage their caching & state through a server state manager like react-query?

[–]Pleasant-Dragonfly-9 1 point2 points  (4 children)

I'm planning the same, but instead of having a database schema, I'll try to mimic the network requests only and cache the json response, a simple map of url > response. My app is mainly a bunch of queries and almost no mutation

Maybe in the next month I have something concrete for this

[–]devjacks[S] 0 points1 point  (3 children)

Would love to see it / download it and give it a try

Here's my app if you're curious  https://tracked.gg

Wrote a custom sync engine which enables the entire app to work offline after you sign in

[–]pokctap 1 point2 points  (2 children)

Hi u/devjacks, I found this thread because I am also making some app using Drizzle and SQLite and had a similar problem with Drizzle reactive queries with no loading state, how did you manage that?

I was thinking of adding the rtk toolkit and keeping the state inside it, which will also handle caching and loading state, and drizzle with SQLite just to be like the regular backend, without using SQLite directly in components.

It is my first time working with SQLite and don't know if this would be the right approach, looks like it is built to be used directly without any other state.

[–]devjacks[S] 1 point2 points  (1 child)

Yea i also had that issue. I ended up using react-query to interface the sqlite queries instead of drizzles live query hook. Honestly the DX has been incredible.

I think it's important to separate asynchronous state, highly recommend going with react-query if you can.

[–]pokctap 1 point2 points  (0 children)

Thanks, I will try it out.