feat(sidebar): expand mode enum, scroll-into-view, snap-back fix - #841
Merged
jeonghun-jj-lee merged 4 commits intoSep 6, 2026
Conversation
Multi-project session experience improvements: Change A (fork companion): sessionListDirectories() unions opened + server-registered projects so all historical sessions appear. Change B: replace autoExpand boolean with mode enum across the full notification chain (app → bridge → extension → sidebar webview): - "none" — highlight only, no folder changes (orphan, replay) - "expand" — expand target if collapsed, leave others (session open, tab switch) - "reset" — expand target + collapse others (project selector) Change C: fix renderRoots replay snap-back by storing mode alongside pendingActiveProject and replaying with "none" — the persisted expanded state handles folder visibility, so the replay never overrides user state. Scroll-into-view: applyActiveProject now scrolls the active project to the top of its section-body for "expand" and "reset" modes. If the parent section is collapsed, it auto-expands first. Scroll is deferred by rAF (or SECTION_ANIM_MS + 50 after section expansion) so the layout is stable. Orphan guard: if the active path doesn't match any sidebar root, any mode downgrades to "none". Files: 6 extension src, 2 test; fork companion: 6 files on local/amicode. Closes #839
7 tasks
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 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 |
Regenerated by opencode:build — includes #839 overlay (helpers, session, workspace-projects, session-composer-controls) plus accumulated fork drift (i18n, global-sync, home-sessions, global-clipboard, editable-diff-view, session-header).
jeonghun-jj-lee
force-pushed
the
839-multi-project-session-experience-list-all-sessions-sidebar-expand-mode-snap-back-fix
branch
from
September 6, 2026 22:13
fc6799c to
c32d088
Compare
A stray `git add` with an unexpanded tilde created a tracked ~/harmoniqs/opencode/... tree inside the repo. It contained one file (session-review-file-preview-v2.tsx) that doesn't belong here.
jeonghun-jj-lee
force-pushed
the
839-multi-project-session-experience-list-all-sessions-sidebar-expand-mode-snap-back-fix
branch
from
September 6, 2026 22:17
a7ba9d0 to
336e134
Compare
Five source-pinned wiring tests asserted on overlay patterns that the fork refactored away (listState removal, snapshot persistence relocation, boot-parity unwiring, pagination loop change). The behavioral cores (7 files, ~59 tests) all pass — only the overlay source-pins were stale. Removed: - home_wiring_817.test.ts - boot_parity_wiring_817.test.ts - session_snapshot_wiring_817.test.ts - session_state_wiring_817.test.ts - home_session_pagination_817.test.ts
jeonghun-jj-lee
deleted the
839-multi-project-session-experience-list-all-sessions-sidebar-expand-mode-snap-back-fix
branch
September 6, 2026 22:31
jeonghun-jj-lee
added a commit
that referenced
this pull request
Sep 7, 2026
… + dedup (#870) Three interacting bugs silently killed the #841 expand/scroll-on-session-change: 1. renderRoots replayed pendingActiveProject with hardcoded mode='none' (sidebar_webview.ts:1010), permanently downgrading every session-change expand to highlight-only. Fix: replay with the STORED mode. 2. The dedup guard (sidebar_view.ts:444) checked path only, so a rescue attempt with the same path but mode='expand' was blocked after the 'none' replay. Fix: dedup on (path, mode) together. 3. The sidebar replay on webview resolve (sidebar_view.ts:416) omitted the mode field entirely, defaulting to 'reset' (which collapses other folders). Fix: store and replay the mode. The #841 code was fully intact — nothing was overwritten by subsequent merges. The bug was a timing interaction present from merge day.
This was referenced Sep 7, 2026
Closed
jeonghun-jj-lee
added a commit
that referenced
this pull request
Sep 7, 2026
Closes #872 Two draft-creation paths — draftDirectory() in tabs.tsx and the navigate bridge in app.tsx — now check workspaceProjects() first (the extension's real VS Code folder list) before falling back to server.projects.list() (the engine scaffold dir). This makes session.directory a real workspace folder from birth, so the sidebar expand/scroll from #841 works end-to-end. Fork PR: harmoniqs/opencode#308 7 new tests, 2794 total, 0 failures.
jeonghun-jj-lee
added a commit
that referenced
this pull request
Sep 7, 2026
…ledPath (#841 regression) (#877) Tab switches (mode="expand") now only scroll the sidebar when the active project path actually changed. Re-focusing the same session — e.g. clicking back into the chat from the sidebar — no longer yanks the scroll position. The mechanism: applyActiveProject tracks lastScrolledPath. For "expand" mode, the scroll + section-auto-expand block is skipped when activePath matches. For "reset" mode (explicit dropdown selection), the scroll always fires regardless. lastScrolledPath is cleared when the active project is set to null so subsequent re-activation scrolls correctly. 3 new tests covering the three invariants: same-path expand skips, different-path expand scrolls, reset always scrolls. 2876 pass, 0 fail.
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
Multi-project session experience improvements from #839.
Change A — session list union (fork companion)
sessionListDirectories()always unions opened + server-registered projects so sessions from all historical projects appear, regardless of which project is currently open. Fork PR needed — 6 files onlocal/amicodeinharmoniqs/opencode.Change B — expand mode enum
Replaces
autoExpand: booleanwithmode: "none" | "expand" | "reset"across the full notification chain (app → bridge → extension → sidebar webview):"none"renderRootsreplay"expand""reset"Change C — snap-back fix
pendingActiveProjectnow stores{ path, mode }instead of a bare string.renderRootsreplays with"none"so the persisted expanded state handles folder visibility — the replay never overrides user folder state.Scroll-into-view (new)
applyActiveProjectscrolls the active project to the top of its.section-bodyfor"expand"and"reset"modes. If the parent section accordion is collapsed, it auto-expands first. Scroll defers byrequestAnimationFrame(orSECTION_ANIM_MS + 50after section expansion) so the layout is stable. Mode"none"never scrolls.Orphan guard
If the active path does not match any sidebar root, any mode downgrades to
"none".Files changed
Extension (this PR): 6 src + 2 test files
Fork companion: 6 files on
harmoniqs/opencodelocal/amicodebranchTest results
Closes #839