Skip to content

Add offline status backups and debounced persistence - #4

Merged
aliorhun merged 2 commits into
mainfrom
feat/offline-data-tools
Sep 27, 2026
Merged

aliorhun merged 2 commits into
mainfrom
feat/offline-data-tools

Conversation

@aliorhun

Copy link
Copy Markdown
Contributor

Summary

Implements items 10–12 in one change set:

  • show a compact online/offline indicator in the editor status bar
  • update the indicator immediately from browser online / offline events
  • add a Backup modal beside Export
  • export all notebooks, the active tab and basic UI preferences as one versioned JSON file
  • validate MathNote backup format and notebook records before restore
  • confirm before replacing the current notebook collection
  • restore language, zoom and sidebar width together with notebook data
  • debounce editor persistence to localStorage by 300 ms
  • keep structural actions (new file, tab switch, delete, restore) synchronous
  • flush pending edits when the page is hidden or unloaded

Backup format

Backups use:

{
  "format": "mathnote-backup",
  "version": 1,
  "exportedAt": "...",
  "files": [],
  "activeIndex": 0,
  "preferences": {}
}

Restore only accepts the supported format/version and validates every notebook name/content pair before applying changes.

Persistence behavior

Normal typing now coalesces repeated synchronous localStorage.setItem() calls into a single write after 300 ms. Actions that change notebook structure still write immediately to avoid losing state during navigation or tab changes.

@aliorhun
aliorhun merged commit b893cfc into main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant