Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep browser pages aligned during panel animations #12329

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/12329/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Closing the last browser tab with X and opening a chat link can leave the integrated browser blank when panel animations are enabled. The page loads successfully, but its fixed-position surface keeps the panel's initial offscreen position.

Observe the inline panel as well as the browser placeholder. The panel animates its outer width while the placeholder stays at full width, so observing only the placeholder misses its movement. The existing observer cleanup covers both elements.

Verification

  • Regression test fails on the original code and passes with the fix, including observer cleanup on unmount.
  • 15 focused browser tests pass; web typecheck passes; targeted formatting/lint passes with one existing effect-dependency warning; React Doctor reports 100/100.
  • Reproduced the native X-close → chat-link reopen flow in an isolated Electron app with 100 ms panel animations. On the original code the page remained at x=1100, outside the window, while its placeholder settled at x=618. With the fix, 20 animated close/reopen cycles ended with matching positions.

Before / after

Actual base (e26af33b2287) and fixed code, matching fixture and viewport. The unrelated composer is hidden in both captures. Recordings omit idle waits between actions.

Before: reopened page is blankAfter: reopened page is visible
Before: integrated browser remains blank after closing and reopeningAfter: integrated browser displays the reopened page

Before recording:

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/c2f289b38c604d3e/browser-before-short.mp4

After recording:

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/4e037b91628a826f/browser-after-short.mp4

Prepared with the Codex harness.


Devin Review

Summary by CodeRabbit

  • Bug Fixes

    • Improved inline preview panel updates during resizing and animation.
    • Surface positioning now stays accurate when the panel moves, even if the slot size remains unchanged.
  • Tests

    • Added coverage for panel movement across multiple widths.
    • Verified proper cleanup and fallback behavior when the preview is closed.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      A prior Macroscope approval was dismissed. Re-evaluating f2259a7…

    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review Change StackReview Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Team

      Run ID: 7608f953-b980-4c51-ba99-bf23675fbcbe

      📥 Commits

      Reviewing files that changed from the base of the PR and between e26af33b228792bb72349ca4e849a96381578a57 and d6b53b8d652ef117d790216c3958ff9f319d904c.

      📒 Files selected for processing (2)
      • apps/web/src/browser/BrowserSurfaceSlot.test.tsx
      • apps/web/src/browser/BrowserSurfaceSlot.tsx

      Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


      📝 Walkthrough

      Walkthrough

      BrowserSurfaceSlot now observes the nearest inline preview panel. Tests verify position updates during panel opening and observer cleanup after unmounting.

      Changes

      Preview panel observation

      Layer / File(s)Summary
      Panel resize handling
      apps/web/src/browser/BrowserSurfaceSlot.tsx, apps/web/src/browser/BrowserSurfaceSlot.test.tsx
      BrowserSurfaceSlot observes inline preview panel resizing. Tests verify rectangle updates across opening widths, fallback restoration, surface hiding, and observer disconnection.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: bmdavis419

      Merge Risk: ⚪ Minimal · up to f2259

      The browser surface now tracks the animated inline panel position and releases its observers on unmount. No actionable merge-blocking risk remains.

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the web fix and its effect on browser page alignment during panel animations.
      Description check✅ PassedThe description explains the bug, the fix, verification results, and UI behavior. It includes before/after screenshots and recordings for the animation-related change. It does not use the template hea…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches 💡 1
      📝 Generate docstrings 💡
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    4. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.5 KiB13.5 KiB−10 B (−0.1%)15.1 KiB✅
      CodexThread snapshot wire7.1 KiB7.1 KiB+1 B (+0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.5 KiB6.5 KiB−11 B (−0.2%)7.8 KiB✅
      CodexLive turn WebSocket decoded56.3 KiB56.3 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages10100 (0.0%)21✅
      ClaudeTotal thread wire13.5 KiB13.5 KiB+28 B (+0.2%)15.1 KiB✅
      ClaudeThread snapshot wire7.1 KiB7.1 KiB−1 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.4 KiB+29 B (+0.4%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.0 KiB57.0 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages990 (0.0%)21✅

      Baseline: e26af33 · PR result: d6b53b8 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 114.0 KiB
      • Claude decoded thread snapshot: 114.7 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    5. juliusmarminge merged this4cc984f

    6. juliusmarminge closed this

Sign in to join this conversation.