Add auto-saving draft with Save / Save As and Wipe#108
Add auto-saving draft with Save / Save As and Wipe#108alex-rawlings-yyc wants to merge 7 commits into
Conversation
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds a per-project draft buffer with save, save as, discard, and wipe flows, updates the loader and modal wiring around that draft state, introduces morphology display and editing controls, bundles view options, and expands tests, strings, menus, settings, and supporting mocks. ChangesDraft workflow and morphology UI
Sequence Diagram(s)sequenceDiagram
participant User
participant InterlinearizerLoader
participant ProjectModals
participant Main
participant ProjectStorage
User->>InterlinearizerLoader: Save / Save As / Wipe action
InterlinearizerLoader->>ProjectModals: open saveAs or confirm flow
ProjectModals->>Main: createProject / saveAnalysis / getProject
InterlinearizerLoader->>Main: saveDraft
Main->>ProjectStorage: saveDraft(sourceProjectId, draft)
ProjectModals-->>InterlinearizerLoader: markSynced or loadFromProject
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
alex-rawlings-yyc
left a comment
There was a problem hiding this comment.
@alex-rawlings-yyc resolved 7 discussions.
Reviewable status: 0 of 29 files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).
c99f7ea to
6fa7dfa
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
03ce6af to
58101e8
Compare
Editing the interlinearizer no longer writes to the active project on every
keystroke. Each source project now has an always-present draft
(draft:{sourceProjectId}) that auto-saves every edit to papi storage,
decoupled from the user's saved projects and never shown in the picker, so
work is never lost.
Persistence is now explicit:
- Save writes the draft to the active project
- Save As writes the draft to a new project, or overwrites an existing one
- New starts an empty draft (a project is created only on Save As)
- Open loads a project into the draft as a working copy
- Wipe clears the draft — the current book or the whole thing
Switching projects (New / Open) while the draft is dirty prompts to discard.
The tab title shows a "●" marker while the draft has unsaved changes, toggled
via updateWebViewDefinition (Platform.Bible exposes no native unsaved-tab
indicator).
Implementation:
- DraftProject type + isDraftProject guard; getDraft/saveDraft storage with a
per-source serialization queue; getDraft/saveDraft backend commands.
- useDraftProject hook owns the draft (autosave, dirty tracking, and a
draftVersion that remounts the editor on New/Open/Wipe).
- New SaveAsProjectModal, WipeConfirm, and DiscardDraftConfirm; the New modal
is repurposed to configure a draft rather than create a project.
- removeBookFromAnalysis util backs the per-book wipe.
Alignment links are intentionally not carried in the draft yet (no link-editing
feature exists); Save preserves a target project's existing links.
Deferred UX decisions are recorded in user-questions.md. 988 tests, 100%
coverage, lint clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- markSynced now only clears the dirty flag when the live draft still matches the persisted snapshot, so a gloss edit made during an in-flight Save / Save As no longer clears the unsaved-changes indicator while the project is left stale. The save paths pass the analysis they wrote. - The discard-changes confirmation overlays the active modal instead of replacing it, so canceling returns to the Create dialog with its typed input intact, and confirming Open no longer unmounts and re-fetches the still-open select modal underneath. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58101e8 to
ad59825
Compare
Editing the interlinearizer no longer writes to the active project on every keystroke. Each source project now has an always-present draft (draft:{sourceProjectId}) that auto-saves every edit to papi storage, decoupled from the user's saved projects and never shown in the picker, so work is never lost.
Persistence is now explicit:
Switching projects (New / Open) while the draft is dirty prompts to discard. The tab title shows a "●" marker while the draft has unsaved changes, toggled via updateWebViewDefinition (Platform.Bible exposes no native unsaved-tab indicator).
Implementation:
Alignment links are intentionally not carried in the draft yet (no link-editing feature exists); Save preserves a target project's existing links.
Deferred UX decisions are recorded in user-questions.md. 988 tests, 100% coverage, lint clean.
This change is
Summary by CodeRabbit
Release Notes