Summary
Add local autosave and recovery for subtitle editing sessions. This strengthens the app's offline/PWA promise without adding accounts, cloud storage, or backend state.
Why this is in scope
The app is intentionally local-first and browser-based. Losing unsaved subtitle edits on refresh or crash is a major workflow risk, and a local recovery layer directly supports the existing privacy/design principles.
Initial scope
Persist subtitle project state locally:
- Tracks and track names.
- Active track ID.
- Subtitle text/timing data.
- VTT header/prologue metadata.
- Relevant editor preferences like track labels and QA thresholds if available.
Do not persist media file contents in the first version.
Implementation plan
-
Define a project snapshot schema.
- Create
lib/local-session.ts.
- Include a schema version, timestamp, app version if available, and track state.
- Keep media file names as display-only metadata if useful, but do not assume the file can be reopened.
-
Choose storage.
- Use
localStorage for a first minimal implementation if snapshots are small enough.
- Consider IndexedDB if track payloads become large.
- Namespaced key:
subtitle-editor:autosave:v1.
-
Debounced persistence.
- Save after subtitle/track changes with a debounce, e.g. 500-1000ms.
- Avoid writing on every playback tick.
- Persist only serializable project state, not undo stacks in the first version unless straightforward.
-
Recovery UX.
- On app load, detect an autosaved session newer than the empty/default state.
- Show a small recovery banner/dialog: restore, discard, or download backup.
- After restore, keep normal editing and saving flows.
-
Privacy and safety.
- Add clear copy that autosave is local to the browser only.
- Provide
clear autosave after successful manual download or from settings.
- Handle corrupt/old snapshots gracefully.
-
Tests.
- Add unit tests for serialization/deserialization and version handling.
- Add component tests for restore/discard if feasible.
Acceptance criteria
- Edits are saved locally after changes without a backend.
- Reloading the page offers to restore the previous subtitle session.
- Users can discard or clear the local autosave.
- Media files are not silently uploaded or persisted.
Summary
Add local autosave and recovery for subtitle editing sessions. This strengthens the app's offline/PWA promise without adding accounts, cloud storage, or backend state.
Why this is in scope
The app is intentionally local-first and browser-based. Losing unsaved subtitle edits on refresh or crash is a major workflow risk, and a local recovery layer directly supports the existing privacy/design principles.
Initial scope
Persist subtitle project state locally:
Do not persist media file contents in the first version.
Implementation plan
Define a project snapshot schema.
lib/local-session.ts.Choose storage.
localStoragefor a first minimal implementation if snapshots are small enough.subtitle-editor:autosave:v1.Debounced persistence.
Recovery UX.
Privacy and safety.
clear autosaveafter successful manual download or from settings.Tests.
Acceptance criteria