Sync engine & real-time data management #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Requirements
Not doing
No offline mode. Client cannot write data without being connected, and there will be no local cache to load data offline on boot.
However, client should receive replay of all transactions from the sync server on reconnect.
Components
There are a few core components for building the sync engine:
Flow
For writes:
Client state management
On the client side, we want to either use MobX or Zustand. All data should reside in a client-side object pool.
And then particular views can construct derived state based on the object pool.
Note to self: many of these sync engine abstractions end up being overly complex and create leaky abstractions.
It's easier to build our own system that we own and understand. Start simple and expand over time.
As advised here, there are various loopholes with local-first.
We will not be taking on this work for now:
Instead, for now, we will focus on creating a real-time experience that is more conventional similar to the following:
To keep it simpler, we can even group data together in react query; for example, one react query hook can fetch 3 endpoints but represent one key, and invalidations would refetch entire sets of data. Particular views can reuse this cached data and filter appropriately.
We will setup firestore with our gcp project to launch a real-time multiplayer app sooner.