You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On top of the push-only mode described in #5, another alternative to the offline-first paradigm would be to use RxDB more like an offline cache. Basically, instead of fetching all data, we only update the RxDB with the results from Supabase whenever we make a query. So RxDB will only contain the subset of the Supabase that the user has actually viewed.
The algorithm for querying would look something like this:
If offline, just serve the query from RxDB
Otherwise, make sure any pending local changes are pushed to Supabase already
Perform the query to RxDB and Supabase in parallel. Assuming we're returning an Observable, you could return the cached RxDB results first and then follow up with the Supabase results
Once both have returned, update the state of the RxDB cache as follows:
Documents that are part of both the RxDB and Supabase result will be updated to match the Supabase state
Documents in the Supabase result that weren't in RxDB will be inserted to RxDB
Documents in the RxDB result that weren't in Supabase will be deleted from RxDB
In this paradigm, you would not need _modified or _deleted fields in the database. However, you would need a completely new API for querying that can translate to both RxDB and Supabase queries. So simple equality and inequality checks would work, but nothing too advanced. In fact, implementing LIMIT might already be tricky (but I think it's possible)
RxDB and its replication mechanism weren't really designed for something like this, but I do think it would be possible.
The text was updated successfully, but these errors were encountered:
On top of the push-only mode described in #5, another alternative to the offline-first paradigm would be to use RxDB more like an offline cache. Basically, instead of fetching all data, we only update the RxDB with the results from Supabase whenever we make a query. So RxDB will only contain the subset of the Supabase that the user has actually viewed.
The algorithm for querying would look something like this:
In this paradigm, you would not need
_modified
or_deleted
fields in the database. However, you would need a completely new API for querying that can translate to both RxDB and Supabase queries. So simple equality and inequality checks would work, but nothing too advanced. In fact, implementing LIMIT might already be tricky (but I think it's possible)RxDB and its replication mechanism weren't really designed for something like this, but I do think it would be possible.
The text was updated successfully, but these errors were encountered: