Open warrenbhw opened 1 week ago
hmmm... thinking about this for a few mins, I'm thinking this may be about soft vs. hard delete. It sounds like this may be happening because under-the-hood, legend-state is trying to set a "deleted" column, but I don't current have a "deleted" column on my table
Will try adding that and see what changes
OK - that did seem to be the issue. Needed a deleted
column on the table. Closing.
This is a problem, I'll look into it.
@jmeistrich two somewhat related questions...
@jmeistrich possibly related:
wen I turn off local persistence, but turn on realtime subscription from supabase, deleting a row in supabase (from a different client) causes my local state to update so that I actually create a new row with no attributes, but don't delete the row that should be deleted.
my suspicion is that somewhere we're doing a set/assign/update (whatever the appropriate term is in this context) rather than a delete.
I believe alpha.26 should fix this problem. Does it work better for you after the update?
For resetting, the syncState has a clearPersist function: https://legendapp.com/open-source/state/v3/sync/persist-sync/#syncstate. I'm also working on a way to clear all persistences globally, but it's not quite done yet.
The version parameter basically goes straight into indexedDB.open(databaseName, version)
. You'd change that version when you want to add or remove tableNames
to make it change the database to have those tables.
gotcha! I'll test persistence in the next few hrs.
One option I'd be interested in is simply blowing away any local data and recreating the local persistent store if the version number changes.
Operationally, this seems like the simplest and least-bug-prone way for me to start making my application local-first.
I have a nextJS app router application, and I'm using syncedSupabase and indexedDB persistence. When I attempt to delete an observable, I see this error in the console: