Skip to content

Composer typing lags after a few letters #654

Closed

Description

@currentbits

Problem

Typing in the thread composer gets sluggish after a few characters. Each keystroke writes React state in Composer, which re-renders the whole composer (model picker rows, permission/build chrome, slash/mention refresh) even when the prompt is plain text.

Controlled <textarea value={draft}> also fights Chromium input: caret restore, spellcheck, and field-sizing: content layout run on every letter.

Fix

  • Keep the draft in a ref. The textarea is uncontrolled (key={threadId} + defaultValue).
  • Only flip React state when hasPrompt changes (empty ↔ non-empty), or when mention/slash popups actually need to paint.
  • Do not setState to a new [] on every closeMention while already closed (onChange + onSelect currently double-fire).
  • spellCheck={false} / autoComplete="off" on the prompt field.
  • Cap field-sizing: content with a max-height so a long paste cannot reflow the transcript.

Tests

  • Plain typing after the first letter must not rebuild model-picker chrome.
  • Drafts still isolate per thread.
  • @ mention and / palette still work.

Activity

  1. added
    bug
    plan:doing
    plan:done
    and removed
    plan:doing
    on Aug 22, 2026
  2. currentbits commented on Aug 22, 2026

    @currentbits
    OwnerAuthor

    Composer prompt is now an uncontrolled textarea. Draft lives in a ref; React only paints when hasPrompt flips or a mention/slash popup needs to. Verified: composer + mention + slash + ThreadView tests, tsc clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions