bookmark-notes
bookmark-notes copied to clipboard
Improve sync logic
Currently, notes are kept in storage.sync
only, which is overwritten each time Firefox Sync does its thing. This can potentially result in partial data loss if, for instance, a note is added before Firefox syncs the latest data.
To solve this, my plan is as follows:
- Convert notes into objects with the following properties:
-
content
: The content of the note -
modified
: A timestamp of the last time the note was changed
-
- Save notes to and read from
storage.local
- Copy from local -> sync
- Whenever
storage.sync
changes, compare timestamps of each note, create a new object with the most recent notes, then update both local and sync
Since this will require migrating note objects to a new format that will break backward compatibility, it's better suited for a larger release, and most certainly after #26 has been resolved.