Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): floating portrait previews no longer crash beside the details card #14968

ClosedGigioxx(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/14968/headopened View on GitHub

Fixes #14959

With a portrait preview floating beside the inline thread details card, a chat canvas around 1176 to 1247 px wide crashes the renderer with React error #185. The card was placed from a chat lane that had already been solved with the card as an obstacle. Clearing the card moved the preview and narrowed the lane, which widened the card, which made clearing it impossible, which restored the lane. The two states flipped on every layout effect until React gave up.

resolveChatCanvasLayout now also returns cardChat, the lane computed without the card. ThreadDetailsCard uses it for both the drawn placement and the reported obstacle, so placing the card can no longer move the lane it is placed beside. The card rect is still used to clamp the preview.

Verification

  • Reproduced in an isolated Playwright Chromium against a worktree dev server seeded with a copy of real data: 1456x800 window (1200 px chat canvas), inline details card open, iOS device floated over chat. Unfixed code shows "Maximum update depth exceeded". With the fix, the player settles at x 952 to 1192 and the card at 1204 to 1444, no crash. The device float needs a live device session, so for this manual check only I disabled the auto-close for missing sessions in ChatView (not part of this PR).
  • New test in chatCanvasLayout.test.ts iterates the two layout functions for the 1200x600 portrait case from the issue. It fails on main (state alternates between card 876 and 948) and passes with the fix.
  • vp test run apps/web/src/components/chat/chatCanvasLayout.test.ts: 17 passed. apps/web typecheck, lint and fmt clean.
  • Not checked: desktop app and a real simulator stream.
BeforeAfter

Made by Claude Opus 5.5 in Claude Code (via T3 Code).

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 248279b

      Macroscope's review found this PR approvable — This is a contained web layout bug fix that breaks the details-card/preview geometry feedback loop responsible for the renderer crash. Existing paths remain unchanged when no floating preview and card are present, and a regression test covers repeated layout stabilization.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: d059089c-efac-40fc-b54e-0637216abf4e
      📥 Commits

      Reviewing files that changed from the base of the PR and between 8ed276c246b624631e7d39241ebfd22d8314cb68 and 248279be823664bccec386cde320224d021f87d3.

      📒 Files selected for processing (3)
      • apps/web/src/components/chat/ThreadDetailsCard.tsx
      • apps/web/src/components/chat/chatCanvasLayout.test.ts
      • apps/web/src/components/chat/chatCanvasLayout.ts

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


      📝 Walkthrough

      Walkthrough

      The layout resolver now provides a separate chat lane for details-card placement when a preview and details card are present. Both placement calculations use that lane. A regression test checks that repeated layout passes stabilize.

      Changes

      Details card layout

      Layer / File(s)Summary
      Resolve a card-specific chat lane
      apps/web/src/components/chat/chatCanvasLayout.ts
      The resolver returns a cardChat lane. When a preview and details card are present, it derives the lane by resolving the layout without the details card.
      Use and validate cardChat placement
      apps/web/src/components/chat/ThreadDetailsCard.tsx, apps/web/src/components/chat/chatCanvasLayout.test.ts
      Both placement calculations use cardChat. The settling test feeds each card placement into the next layout pass and checks that card and frame state stabilize.

      Priority: ➖ Normal

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

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 24827

      The portrait-preview layout fix appears ready to merge after normal checks; no actionable merge-blocking risk is identified.

      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly describes the main change: preventing floating portrait previews from crashing beside the details card.
      Description check✅ PassedThe description explains the problem, the fix, and detailed verification results, and links issue #14959. It does not explicitly address scope and approval, but the linked issue and focused bug fix pr…
      Linked Issues check✅ PassedIssue #14959 requires stable placement for a floating portrait preview and inline details card, with a fixed-point regression test. resolveChatCanvasLayout returns cardChat, resolved without the c…
      Out of Scope Changes check✅ PassedThe reported changes are limited to chatCanvasLayout.ts, ThreadDetailsCard.tsx, and the layout regression test. The new lane and its test directly address issue #14959. No unrelated change is repo…
      Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    4. Note

      Grok responding on behalf of Julius.

      Closing as superseded. #14959 was fixed on main by #14992 (429c625a8515). Thanks for the earlier fix attempt, @Gigioxx.

    5. juliusmarminge closed this

Sign in to join this conversation.