Repository navigation
feat(hosts): return to the previous page and folder after the last terminal closes - #660
Merged
Merged
Conversation
Closing the last terminal remounts the Hosts page, which reset its folder path to the root. Folder navigation now remembers the open folder per object type for the app session, so Hosts, Snippets, Keychain and Port Forwarding (desktop and mobile) reopen where the user left them. Only the open folder id is kept; the breadcrumb is derived from its ancestors, so a folder renamed or moved meanwhile restores under its current name and parent, and a deleted or out-of-scope one falls back to the root. Mobile back handling uses a shared navigateUp. Closes #654
Closing the last terminal always switched to Hosts, and closing the last tab from another page (Snippets, Keychain, ...) pulled the user to Hosts too. The UI store now remembers the last page shown before the terminal view, and leaveTerminal() goes back to it only when the terminal view is showing. Hosts remains the fallback. Closing a terminal while others remain still activates another session, unchanged.
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.
Closes #654
Problem
Closing the last terminal (with
exitor by closing the tab) switches back to the Hosts page, which remounts and resets its folder path to the root. Users with nested folders had to click back down after every session.Change
useFolderNavigationtakes an optionalrememberAskey and keeps the open folder in memory for the app session. Every caller passes its folder object type, so Hosts, Snippets, Keychain and Port Forwarding (desktop and mobile) reopen in the folder the user left.setFolderPath((p) => p.slice(0, -1))back handlers are replaced by a sharednavigateUp.Return to the previous page
lastPageNav, the last page shown before the terminal view.leaveTerminal()goes back to it, but only while the terminal view is showing.exit) andcloseSessionTabs/ split-tab close. Before, closing the last tab from Snippets or Keychain pulled the user to Hosts; now they stay where they are.Side effect: switching between pages (Hosts → Snippets → Hosts) also keeps the folder. The memory does not survive an app restart.
Tests
useFolderNavigationtests: restore after remount, deleted folder falls back to root, memory is per key and off without a key, renamed folder shows its current name, moved folder restores under its new parent, a parent cycle does not loop,navigateUp.uiStore.leaveTerminaltests: back to the previous page, stays on another page, members shortcuts count, Hosts fallback.tsc --noEmitclean; layout / useKeyboard / store suites pass; hosts / snippets / keychain / port forwarding / mobile / hooks / utils test suites pass.