a-type / verdant

🌿 Storage, sync & realtime for local-first web apps. Build an app in minutes, deploy as a static page, and add sync with a few lines.
https://verdant.dev
MIT License
193 stars 4 forks source link

After bootstrapping a new replica for a library with 10k+ baselines, metadata is intact but no collection docs are written #353

Closed a-type closed 8 months ago

a-type commented 8 months ago

Nothing obviously bad in logs, besides there simply being a ton of reactive updates as everything gets loaded in.

I think it's time to re-approach the reset sync handling to bypass reactivity and re-initialize the client.

a-type commented 8 months ago

Oh, this was in there...

error Error saving entities to queryable storage DOMException: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
    at createAbortableTransaction (http://localhost:4444/node_modules/.vite/deps/chunk-X6WNNQHJ.js?v=a178b073:930:17)
    at IDBService.createTransaction (http://localhost:4444/node_modules/.vite/deps/chunk-X6WNNQHJ.js?v=a178b073:974:18)
    at QueryableStorage.saveEntities (http://localhost:4444/node_modules/.vite/deps/chunk-X6WNNQHJ.js?v=a178b073:4073:27)
    at EntityStore.processData (http://localhost:4444/node_modules/.vite/deps/chunk-X6WNNQHJ.js?v=a178b073:4231:37)
    at async EntityStore.addData (http://localhost:4444/node_modules/.vite/deps/chunk-X6WNNQHJ.js?v=a178b073:4162:7)
    at async ServerSync.handleMessage (http://localhost:4444/node_modules/.vite/deps/chunk-X6WNNQHJ.js?v=a178b073:5222:11)
a-type commented 8 months ago

Looks like it's due to old collection data being present in the sync.

Short term solution: filter out old data before saving document indexes.

Longer term: need to clean out old collections so there aren't dead docs in sync data forever.

a-type commented 8 months ago

First mitigation implemented. Tested and works.

Second part is covered in #313