Skip to content

fix(ui): toggle files pane independently - #757

Merged
benvinegar merged 6 commits into
modem-dev:mainfrom
tridha643:fix/independent-sidebar-panes
Aug 16, 2026
Merged

benvinegar merged 6 commits into
modem-dev:mainfrom
tridha643:fix/independent-sidebar-panes

Conversation

@tridha643

Copy link
Copy Markdown
Contributor

Problem

The s shortcut toggles one global sidebar-area visibility flag. When an extension contributes a right-side pane, pressing s therefore hides both the built-in files pane and the extension pane even though the extension pane remains logically open. Reopening the extension pane can also bring the files pane back, which makes their controls feel coupled.

Approach

  • Make hunk.view.toggleSidebar toggle the active files pane's existing pane-open state instead of the global wrapper around every horizontal pane.
  • Preserve replacement-pane behavior by targeting the pane that replaces hunk:files when one is registered.
  • Keep extension commands authoritative for their own panes; this does not add or change extension APIs.
  • Rename the user-facing action to Toggle files pane and update generated/user documentation.

This belongs in core because the built-in s command and global sidebar-area state are host-owned. Extensions cannot override the built-in chord or prevent the host from hiding every left/right pane.

Behavior

Before:

files | review | extension
  s   -> review

After:

files | review | extension
  s   -> review | extension
Ctrl+G -> files | review

No change is intended to responsive omission: when the terminal cannot fit every requested pane while preserving the minimum review width, Hunk may still omit a pane from that frame. The logical open states remain independent.

Validation

  • TMPDIR="$PWD/.tmp" bun test src/ui/AppHost.extension-sidebar.test.tsx src/ui/lib/appCommands.test.ts src/ui/lib/appMenus.test.ts src/core/commandCatalog.test.ts (52 passed)
  • bun run format:check
  • bun run typecheck
  • bun run lint
  • bun run check:docs
  • TMPDIR="$PWD/.tmp" bun run test:integration (103 passed, 8 pager timeouts; the representative pager mode hides chrome and pages forward on space timeout reproduces unchanged on main)

Manual UI check

Tested the compiled standalone binary on macOS in Ghostty with zsh at 197x56. With the built-in files pane and the hunk-calldiff right pane open, s closed and reopened only files; Ctrl+G closed and reopened only Call Flow.

Release

Includes a patch Changeset for hunkdiff.

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

@tridha643 is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@tridha643
tridha643 requested a review from benvinegar August 15, 2026 20:53
@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR decouples the built-in files-pane shortcut from extension-pane visibility and updates its labels and documentation. The fallback handling remains inconsistent after extension re-registration.

  • Targets the active files pane from hunk.view.toggleSidebar.
  • Transfers visibility to the built-in files pane when a replacement crashes.
  • Adds extension-sidebar regression coverage and updates command documentation.

Confidence Score: 4/5

The PR is not yet safe to merge because a soft extension reload can restore the files-pane replacement as the toggle target while the built-in fallback remains visible.

The prior reply from an author whose name is not shown says the fallback issue was fixed, but a crashed replacement followed by a resetApp-false extension reload creates a fresh unquarantined registration while retaining the built-in fallback’s open state, so s again targets the wrong pane.

Files Needing Attention: src/ui/App.tsx and src/ui/AppHost.extension-sidebar.test.tsx

Important Files Changed

Filename Overview
src/ui/App.tsx Decouples files-pane toggling and adds crash fallback transfer, but re-registration can make the visible fallback diverge from the selected toggle target.
src/ui/AppHost.extension-sidebar.test.tsx Covers independent pane toggling and immediate post-crash fallback toggling, but not the soft extension-reload transition that revives the mismatch.
src/core/commandCatalog.ts Renames the existing sidebar command to accurately describe its new files-pane behavior.
docs/keybindings.md Updates generated keybinding documentation to label s as the files-pane toggle.
website/src/content/docs/docs/start/keyboard-and-mouse.md Updates user-facing keyboard documentation consistently with the command behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Replacement pane crashes] --> B[Quarantine old registration]
  B --> C[Close replacement and open built-in fallback]
  C --> D[Soft extension reload preserves App state]
  D --> E[Fresh replacement registration is not quarantined]
  E --> F[User presses s]
  F --> G[Toggle targets replacement instead of visible fallback]
Loading
Prompt To Fix All With AI
### Issue 1
src/ui/App.tsx:1461
**Reload restores wrong toggle target**

When a files-pane replacement crashes and extensions are reloaded without remounting `App`, the fresh registration is no longer quarantined while the built-in fallback remains open. Pressing `s` then targets the replacement instead of closing the visible fallback, reopening or re-crashing the replacement while leaving the fallback visible.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (2): Last reviewed commit: "fix(ui): preserve files pane fallback to..." | Re-trigger Greptile

Comment thread src/ui/App.tsx Outdated
@tridha643

Copy link
Copy Markdown
Contributor Author

@greptile

Comment thread src/ui/App.tsx Outdated
@benvinegar

Copy link
Copy Markdown
Member

Hmm, maybe I don't understand this. My expectation is if you added your own sidebar or panel, you would register your own keys for opening it.

@benvinegar

Copy link
Copy Markdown
Member

Nice!

@benvinegar
benvinegar merged commit 6d8752a into modem-dev:main Aug 16, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants