-
-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
Describe the bug
Hi, I'm doing a setup using Tinybase and automerge, and I notice I couldn't get the persistence from automerge to works.
I debug it, and I notice it was saving properly, but when I was reading it, the store always came back clean.
I traced it down to this first line in the createAutomergePersister code:
| docHandle.change((doc: any) => (doc[docObjName] = {})); |
So on start, it causes a new transaction that clears all the contents in the document.
I did a simple fix as (note the replacement of = with ||=):
docHandle.change((doc) => (doc[docObjName] ||= {}));So this way I can start tinybase with an automerge doc that always has data.
Platform
- OS: All
- Browser: All
- Version: 5.1.2
Metadata
Metadata
Assignees
Labels
No labels