Skip to content

feat(editor): add auto-save with debounce, conflict detection#1089

Merged
perber merged 4 commits into
mainfrom
feature/auto-save
Jun 2, 2026
Merged

feat(editor): add auto-save with debounce, conflict detection#1089
perber merged 4 commits into
mainfrom
feature/auto-save

Conversation

@perber

@perber perber commented May 31, 2026

Copy link
Copy Markdown
Owner
  • Debounced auto-save (2s) watches content, tags, and frontmatter fields
  • Silent saves skip the global progress bar
  • Version conflict pauses auto-save and prompts manual resolution
  • Status indicator in editor title bar (Saving… / Saved ✓ / Auto-save paused)
  • Auto-save toggle button in toolbar (Cloud/CloudOff icon, persisted to localStorage)
  • Auto-save skipped when slug changes (requires manual save)

Copilot AI review requested due to automatic review settings May 31, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds client-side editor auto-save with persisted enable/disable state, silent saves, conflict-pausing behavior, and title-bar save status feedback.

Changes:

  • Adds an autoSave editor preference persisted in localStorage and a toolbar toggle button.
  • Introduces useAutoSave with debounced silent saves, metadata validation skipping, slug-change skipping, and conflict pause handling.
  • Updates save plumbing to support silent saves and displays auto-save status in the editor title bar.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui/leafwiki-ui/src/stores/editor.ts Persists the auto-save preference and toggle action.
ui/leafwiki-ui/src/features/editor/useToolbarActions.tsx Adds the toolbar control for enabling/disabling auto-save.
ui/leafwiki-ui/src/features/editor/useAutoSave.ts Implements debounced auto-save and shared status state.
ui/leafwiki-ui/src/features/editor/pageEditorStore.ts Adds silent save support and a save mutex.
ui/leafwiki-ui/src/features/editor/PageEditor.tsx Wires the auto-save hook into the editor lifecycle.
ui/leafwiki-ui/src/features/editor/EditorTitleBar.tsx Displays Saving/Saved/Paused auto-save status.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/leafwiki-ui/src/features/editor/useAutoSave.ts
Comment thread ui/leafwiki-ui/src/features/editor/useAutoSave.ts Outdated
@perber
perber force-pushed the feature/auto-save branch 4 times, most recently from 8b1ea22 to ab8c501 Compare June 2, 2026 10:02
perber and others added 3 commits June 2, 2026 14:52
…olbar toggle

- Debounced auto-save (2s) watches content, tags, and frontmatter fields
- Silent saves skip the global progress bar
- Version conflict pauses auto-save and prompts manual resolution
- Status indicator in editor title bar (Saving… / Saved ✓ / Auto-save paused)
- Auto-save toggle button in toolbar (Cloud/CloudOff icon, persisted to localStorage)
- Auto-save skipped when slug changes (requires manual save)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Limit the navigation guard to blocked transitions and clean up the dialog state when leaving the editor. Add an end-to-end test for the Leave anyway flow so the regression stays covered.
@perber
perber force-pushed the feature/auto-save branch from 82cc1f2 to 801329a Compare June 2, 2026 13:03
@perber perber linked an issue Jun 2, 2026 that may be closed by this pull request
@perber
perber merged commit d5cd824 into main Jun 2, 2026
8 checks passed
@perber
perber deleted the feature/auto-save branch June 2, 2026 13:43
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.

Auto-save

2 participants