Skip to content

perf(app): unmount closed right panel body#619

Merged
Astro-Han merged 2 commits into
devfrom
codex/i602-side-panel-mount
May 14, 2026
Merged

perf(app): unmount closed right panel body#619
Astro-Han merged 2 commits into
devfrom
codex/i602-side-panel-mount

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

Unmount the right panel tab body while the desktop right panel is closed, while keeping the outer panel shell available for width state and open/close transitions.

Also clear the Review scroll element ref on unmount so the review scroll controller does not retain a stale DOM node after the panel body is removed.

Why

Closes #602.

The old right panel architecture kept the tab body mounted even when the panel was visually closed. That meant hidden tabs, tab lists, and active tab content could still exist in the DOM and keep lifecycle work alive. This PR draws the first lifecycle boundary: closed right panel means no mounted panel body.

Related Issue

Closes #602

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

Please focus on the mount boundary in SessionSidePanel and the Review scroll ref cleanup. This PR intentionally does not change the scroll state machine, timeline virtualization, active-tab lazy mounting, or broader right-panel structure.

Risk Notes

Low. The visual shell and width persistence stay in place, but closed-panel content now remounts when the panel opens. Review scroll refs are cleared on unmount to avoid stale DOM references.

How To Verify

Typecheck: bun run typecheck -> passed
Focused unit tests: bun --cwd packages/app test src/pages/session/review-tab.test.tsx src/pages/session/session-side-panel.test.tsx -> 1066 passed, 0 failed
Focused E2E: bun --cwd packages/app playwright test e2e/session/right-panel-width.spec.ts --project=chromium --reporter=line -> 3 passed
Diff check: git diff --check -> no whitespace errors
Electron manual check: bun run dev:desktop -> opened and closed the right panel; open shows status panel, closed state removes right-panel content from the accessibility tree

Screenshots or Recordings

No screenshot attached because this PR has no intended visual delta. The behavior was checked in Electron: opening the right panel still shows the status panel, and closing it removes the panel body from the rendered/accessibility tree.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, primary area, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • Bug Fixes

    • Fixed scroll reference handling to properly clear when review panel components unmount, preventing stale references.
  • Performance Improvements

    • Right panel content now conditionally mounts and unmounts based on open/closed state, reducing memory usage when the panel is not in use.
  • Tests

    • Added comprehensive test coverage for right panel toggle behavior and scroll reference lifecycle management.

Review Change Stack

@github-actions github-actions Bot added app Application behavior and product flows ui Design system and user interface labels May 14, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested priority: P2 (includes user-path files (packages/app/src/pages/session/review-panel-scroll.ts, packages/app/src/pages/session/review-panel-view.tsx, packages/app/src/pages/session/review-tab.test.tsx, packages/app/src/pages/session/review-tab.tsx, packages/app/src/pages/session/session-side-panel.tsx)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 54 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2cc0c2dc-f291-46c4-a1af-291fec868f61

📥 Commits

Reviewing files that changed from the base of the PR and between 56f7d72 and 701e71c.

📒 Files selected for processing (2)
  • packages/app/e2e/session/right-panel-width.spec.ts
  • packages/app/src/pages/session/session-side-panel.tsx
📝 Walkthrough

Walkthrough

The right-panel body is now conditionally mounted only when open, and ref cleanup is coordinated through the component hierarchy by allowing undefined in ref callbacks and notifying listeners when components unmount.

Changes

Right Panel Ref Lifecycle and Conditional Mounting

Layer / File(s) Summary
Panel conditional mounting and component cleanup
packages/app/src/pages/session/session-side-panel.tsx, packages/app/src/pages/session/review-tab.tsx
The right-panel body wraps in a <Show when={open()}> to mount/unmount when panel state changes. SessionReviewTab implements cleanup that calls props.onScrollRef?.(undefined) to notify consumers when the scroll ref is torn down.
Ref callback type propagation
packages/app/src/pages/session/review-panel-view.tsx, packages/app/src/pages/session/review-panel-scroll.ts
The onScrollRef callback contract and setReviewScroll setter are updated to accept `HTMLDivElement
Test coverage for mounting and cleanup
packages/app/e2e/session/right-panel-width.spec.ts, packages/app/src/pages/session/review-tab.test.tsx
E2e test asserts that the tablist DOM element is removed when the panel closes and restored on reopen; unit test verifies that SessionReviewTab invokes the onScrollRef callback with undefined during cleanup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Astro-Han/pawwork#289: Modifies the same right-panel-width.spec.ts to validate right utility panel toggle behavior with aria-hidden and DOM visibility assertions.

Suggested labels

enhancement, P2, app, ui

Poem

🐰 A rabbit's tale of cleanup and care,
When panels close, let refs beware—
Undefined whispers "time to go,"
As Show-when-open steals the show!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: unmounting the closed right panel body for performance. It is concise and directly related to the primary changeset objective.
Description check ✅ Passed The PR description follows the template structure with all major sections completed: Summary, Why, Related Issue, Human Review Status, Review Focus, Risk Notes, How To Verify, Screenshots, and Checklist all filled out appropriately.
Linked Issues check ✅ Passed The changes align with the scope of issue #602: incrementally rewriting the right panel (specifically in-scope Session review surface), with unmounting behavior supporting the modular rollout objective without touching out-of-scope areas.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the mount/unmount boundary in SessionSidePanel and Review scroll ref cleanup per #602. No refactors, dependencies, generated files, or unrelated changes are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/i602-side-panel-mount

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han added enhancement New feature or request P2 Medium priority tech-debt Supplemental cleanup, maintainability, architecture, test, or quality debt context labels May 14, 2026 — with ChatGPT Codex Connector
@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

Perf delta summary

Comparator: pass

Profile / Scenario interaction median interaction worst long task max tbt frame gap p95 frame gap max jank count cls status
default / homepage-cold 32 -> 24 (-8) 40 -> 48 (+8) 62 -> 61 (-1) 12 -> 11 (-1) 16.8 -> 16.8 (0) 166.7 -> 166.6 (-0.1) 3 -> 3 (0) 0 -> 0 (0) pass
default / session-streaming-long 40 -> 48 (+8) 48 -> 64 (+16) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.8 (0) 33.4 -> 16.8 (-16.6) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-call-expand 24 -> 16 (-8) 24 -> 24 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.7 (-0.1) 16.8 -> 16.7 (-0.1) 0 -> 0 (0) 0 -> 0 (0) pass
default / terminal-side-panel-open 48 -> 40 (-8) 48 -> 40 (-8) 0 -> 0 (0) 0 -> 0 (0) 16.7 -> 16.8 (+0.1) 16.8 -> 16.8 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-scroll-reading 32 -> 24 (-8) 32 -> 32 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.8 (0) 16.8 -> 16.8 (0) 0 -> 0 (0) 0.505 -> 0.505 (0) warn: cls
low-end / session-timeline-recompute 112 -> 120 (+8) 144 -> 128 (-16) 100 -> 102 (+2) 160 -> 155 (-5) 83.3 -> 100 (+16.7) 166.6 -> 166.6 (0) 3 -> 3 (0) 0.081 -> 0.081 (0) pass

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the unmounting of the right panel's tab body when closed to improve performance. Key changes include updating scroll reference types to handle undefined, adding cleanup logic to clear scroll references on unmount, and wrapping the panel body in a conditional Show component. New E2E and unit tests were added to verify these changes. Feedback was provided regarding a potential visual regression where the panel content disappears instantly during the closing transition, suggesting a transition-aware unmounting strategy to maintain UI consistency.

Comment thread packages/app/src/pages/session/session-side-panel.tsx Outdated
@Astro-Han Astro-Han merged commit 864780a into dev May 14, 2026
24 checks passed
@Astro-Han Astro-Han deleted the codex/i602-side-panel-mount branch May 14, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows enhancement New feature or request P2 Medium priority tech-debt Supplemental cleanup, maintainability, architecture, test, or quality debt context ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] UI rewrite v2 Area B: right panel modular rollout

1 participant