Extract home document actions from App.vue#87
Conversation
Moves the home selection-mode orchestration (pin, delete, share, rename) into a createHomeDocumentActions factory in features/home. The factory receives the App-owned stores (drafts, recents, pins), the selection instance, the open editor session state, and the native adapters, and reuses the existing share/rename workflows and pinned-document helpers unchanged. Rendering stays in the home components; the template bindings are untouched because App destructures the same four handler names. The only inlining is the mount-time pin prune, which keeps its own two-line stored-id collection now that the actions module owns the equivalent helper. Behavior, storage formats, notices, and log lines are unchanged; the moved logic is covered by new unit tests over the real share/rename workflows plus the existing home-document-management E2E suite.
e19336a to
358cd3e
Compare
|
Review finding confirmed and fixed: the extracted Re-verified after the fix: module tests 10/10 (with the corrected notice-preservation assertions), full unit suite 276/276, ESLint, vue-tsc, production build, and the home-document-management + home-navigation E2E suites 5/5. |
Summary
Second PR of the semantic-decomposition series: moves the home selection-mode action orchestration (pin, delete, share, rename) out of
App.vueinto acreateHomeDocumentActionsfactory infeatures/home. Behavior-preserving — no product behavior, storage format, notice copy, or platform payload changes.Boundary
The factory owns exactly the four selection actions and their two private helpers (selected-record lookup, stored-id collection for pin pruning):
togglePinnedDocuments, stale-notice clearing, selection exit.shareRecentDocumentsWorkflowunchanged; failure keeps the selection for retry, success clears it.State stays in App and is injected as refs (stores + persistence, selection instance, document state, notice); native adapters and settings are injected the same way the workflows already consume them. Pure helpers (
togglePinnedDocuments,renameLocalDraft,getAndroidRecoveryDraftId, …) are imported directly by the module. The template bindings are untouched — App destructures the same four handler names. The one inlining: the mount-time pin prune keeps a local two-line stored-id collection with its explanatory comment.App.vueshrinks by ~190 lines.Testing
homeDocumentActions.test.ts(10 tests) drives the real share/rename workflows with mocked natives: pin toggle/empty-selection no-op, permanent draft delete vs list-only device delete with pin pruning, open-session reset on delete, share failure keeping the selection vs success clearing it, draft rename patching the open session, URI-changing rename migrating record/pin/recovery draft, temporary-access rename dropping entry and pins with its notice, and missing-target warn.mobile-home-document-management.spec.ts(long-press selection lifecycle with delete, temporary-access rename storage assertions, recovery-draft survival) plusmobile-home-navigation.spec.ts— 5/5.