Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep the timeline still when the resting composer expands #12771

Mergedflamboh(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/12771/headmerged by maria-rcks View on GitHub

Note

🤖 Claude Fable 5.1 on behalf of Oliver

ELI5

When you scroll back to the bottom of a chat, the composer grows back to full size and the messages above it jump. Now they stay put.

Problem

The composer rests on timeline scroll and expands again at the end. ChatView measures the composer overlay in layout effects and reserves that height as the timeline's end inset. The prompt's resting clamp classes travel through Tiptap's editorProps, and @tiptap/react forwards option changes to ProseMirror from a passive useEffect, one tick after those measurements. Every rest and expand measurement was therefore off by the prompt's own height change (38px): the reservation grew by 38px on rest and shrank by 38px on expand, which clamped scrollTop and yanked the last rows down.

Measured headless against a long thread: expanded overlay 238px, resting overlay 144px. Reserved inset went 238 → 276 on rest and 276 → 200 → 238 on expand, with scrollTop clamped at that moment. After the fix the inset stays at 238 throughout and scrollTop advances monotonically.

Fix

ComposerPromptEditorTiptap memoizes the editor attributes and pushes them to the ProseMirror view from a useLayoutEffect, so the clamp classes are in the DOM before the composer measures. Going through view.setProps keeps ProseMirror's own class handling intact, and Tiptap's later passive sync sees identical attributes.

UI Changes

Before

before

After

after

Made with Claude Fable 5.1 in Claude Code via T3 Code.

Summary by CodeRabbit

  • Bug Fixes
    • Improved editor initialization and attribute updates for more consistent composer behavior.
    • Reduced visual or state inconsistencies when the composer editor loads or updates.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Review Change StackReview Change Stack

      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: 23491746-530e-4c17-86ca-7727a0c893b4

      📥 Commits

      Reviewing files that changed from the base of the PR and between c14f6015bfe479d313355cb234af1a5c16dbb15f and f53315a14a523e761a12432f48eeec13d5076540.

      📒 Files selected for processing (1)
      • apps/web/src/components/ComposerPromptEditorTiptap.tsx

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


      📝 Walkthrough

      Walkthrough

      The composer editor now memoizes its DOM attributes, reuses them during initialization, and synchronizes updated attributes with the initialized editor view in a layout effect.

      Changes

      Composer editor attribute synchronization

      Layer / File(s)Summary
      Memoized attributes and editor synchronization
      apps/web/src/components/ComposerPromptEditorTiptap.tsx
      The editor stores styling, test, rich-text, and placeholder attributes in a memoized value. Tiptap initialization reuses this value. A layout effect applies current attributes to the initialized editor view.

      Priority: ⬇️ Low

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

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      🚥 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 1 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 primary fix: preventing timeline movement when the resting composer expands.
      Description check✅ PassedThe description explains the problem, technical cause, fix, and UI impact. It includes before-and-after interaction evidence, but it omits the required Checklist section and does not use the template'…
      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.
      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    3. Approvability

      Verdict: Approved at f53315a

      Macroscope's review found this PR approvable — This is a small, self-contained web UI bug fix that preserves the existing editor attributes while applying them before composer geometry measurements. Its runtime impact is limited to preventing timeline jumps during composer layout changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. maria-rcks merged this2d8f9a8

    5. maria-rcks closed this

Sign in to join this conversation.