[Demo] Local-only supabase todo app
This adds a demo project that aims to demonstrate how an app could be built starting from a local-only state and later being "upgraded" to a version that has sync capabilities. It started off as a copy of the existing todo app that was stripped of some of the features. The biggest changes are in powersync.dart, login/signup views, and models/schema.dart (which illustrates how to update the schema to supporting syncing).
The readme has a basic description of how everything works, with a small mermaid diagram to show how the app switches from the local-only mode to sync mode.
@kobiebotha @stevensJourney I've updated the readme, schema comment about switching, and allowed the app to work without specifying credentials in which case login/sign up is disabled.
Good work! Much needed for a seamless experience. I'll try to implement for my app (Typescript).
Good work! Much needed for a seamless experience. I'll try to implement for my app (Typescript).
Hey @guillempuche, a JS/TS version is on the one in the coming weeks too.
There is currently a bug where if the user logs in immediately without creating data, existing data doesn't sync down.
Edit: The issue pertains to the .connect() in powersync.dart resolving too early and watch() breaking when logging in without having any local table entries during the switch from local-only to synced mode.
@Chriztiaan, for defining locally a user id (fingerprint), it can be done with FingerprintJS https://dev.fingerprint.com/docs/identification-vs-fingerprintjs. I'm not sure if this can help you on the Typescript example.
@Chriztiaan, for defining locally a user id (fingerprint), it can be done with FingerprintJS https://dev.fingerprint.com/docs/identification-vs-fingerprintjs. I'm not sure if this can help you on the Typescript example.
This is cool! However I think we want to keep the demos as barebones/unopinionated as possible. I don't currently see a need to demonstrate anything more than a zeroed UUID.
Edit: I think we'll add it somewhere in the documentation though, thanks for the find!
Using new version sqlite_async that has refreshSchema. Updated powersync package to allow invocation of refreshSchema. Added a test, and using refreshSchema after the schema has been updated in the app.
I'm ready for Typescript! This is a great feature for a consumer app. Fewer clicks for experiencing the AHA moment, login is a big barrier