Back from draft editor returns to the screen the user came from#204
Open
therocket-gr wants to merge 2 commits into
Open
Back from draft editor returns to the screen the user came from#204therocket-gr wants to merge 2 commits into
therocket-gr wants to merge 2 commits into
Conversation
…from Previously handleBackFromDraftEditor always routed to the draft's project view, regardless of where the user opened the draft from. Opening a recent draft from Home, All Drafts, the Done tab, or the sidebar quick-link would silently drop the user into a project they never navigated into. editingDraft now records the activeView at the moment it was opened. Back restores that view (and only sets activeProjectId when the origin actually was a project). The two cleanup callsites that used handleBackFromDraftEditor specifically to "exit editor and stay in the project" now clear the editing state inline instead, since they have their own explicit setActiveView and no longer want origin-based routing. Opening another draft while the editor is already open inherits the previous draft's origin so back never chains through the editor itself. Closes #201. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds tests/e2e/back-from-editor.spec.ts covering three origins not exercised before: Home → back → Home, Project view → back → that project, and the chain-through case (open another draft while already in the editor must still route back to the original origin, not loop through the editor). Updates the pre-existing draft-editor.spec.ts case that asserted the old behavior (opening from All Drafts and landing on the project view) to assert the corrected behavior (landing on All Drafts). The back button's aria-label/title was hard-coded "Back to project", which is misleading now that back routes to wherever the user actually came from. Both become a plain "Back". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the back button in the draft editor so it lands on the screen the user was on when they opened the draft, instead of always dropping them into the draft's project view. Closes #201.
Before, opening a recent draft from Home, the All Drafts tab, the Done tab, or the sidebar quick-link would route back into a project the user had never navigated into. The previous
handleBackFromDraftEditorhard-coded the destination to'project'— it had no notion of "where did this draft get opened from."Approach
`editingDraft` now carries an `origin: View` recorded at the moment the editor was opened (via a tiny `resolveDraftEditorOrigin` helper). `handleBackFromDraftEditor` restores that view, only setting `activeProjectId` when the origin is actually `'project'`.
Two existing cleanup callsites used `handleBackFromDraftEditor` as a generic "exit the editor" helper — to drill into a folder, or to preview a non-markdown file. Both have their own explicit `setActiveView('project')` immediately after, so they don't want origin-based routing. Switched them to clear the editing state inline.
Chain-through: if the user is already in the editor and opens another draft (sidebar recent, intra-project link), the new editor inherits the previous draft's origin — back never chains through the editor itself.
Test plan
🤖 Generated with Claude Code