feat(desktop): add file auto save settings

Merged
TH
1mo ago
+2705-3

Closes SUPER-2370

Summary

  • add a persisted Auto Save setting for manually edited v2 workspace files
  • support after-delay, focus-change, and window-change save modes
  • avoid losing delayed saves when edits arrive during an in-flight save
  • localize the option labels

img

image

Testing

  • bun --cwd apps/desktop test src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/FilePane.test.tsx src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.test.ts
  • bun run --cwd packages/local-db typecheck
  • bun run --cwd packages/i18n compile --strict --verbose
  • bunx @biomejs/biome@2.4.2 check ...

Summary by cubic

Closes SUPER-2370. Adds a persisted Auto Save setting for manually edited v2 workspace files, with Off, After delay (3s), On focus change, and On window change modes.

  • Auto-save is managed centrally in the document store, so it also affects files in inactive editors.
  • Deactivating a file pane triggers an autosave through the focus-change mode.
  • Delayed saves are rescheduled when edits arrive during an in-flight save so nothing is lost.
  • Adds a file_auto_save column via migration 0057, tRPC get/set endpoints, and a CLI settings registry entry.
  • Makes the option searchable in Settings and localized across all locale files.
  • Adds unit tests covering save timing, focus-change handling, and rescheduling.

Summary by CodeRabbit

  • New Features

    • Added configurable auto-save for manually edited files, off by default.
    • Choose to save after a 3-second delay, when focus changes, or when switching windows.
    • Find the Auto Save control in Behavior settings, including through settings search.
    • Auto-save pauses for conflicted files and does not automatically retry after a dismissed save error.
  • Localization

    • Added translated auto-save labels, descriptions, and options across supported languages.