🤖 fix: stabilize chat input auto-resize height#3263
Merged
Conversation
Summary
- Ensure the textarea auto-resize hook reapplies the expected pixel height when the cached height matches but the DOM inline style was reset.
- Cover capped-height deletion and external inline-style clearing regressions in the hook tests.
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `1782918{MUX_COSTS_USD:-n/a}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=n/a -->
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
mux-bot Bot
added a commit
that referenced
this pull request
May 10, 2026
The chat input auto-resize stabilization in #3263 added a second `Number.parseFloat(el.style.height)` + `Number.isFinite(...)` pair to verify that the cached pixel height still reflects the textarea's inline style, sitting a handful of lines from the existing pair in the canOnlyGrow first-render fallback. Both spell out the same intent -- read the textarea's inline `height` style as a finite px number, or treat it as missing -- but as two independent expressions they were one stray edit away from drifting on what counts as a usable inline height. Extract a private `readInlineHeightPx(el): number | null` helper that captures the parseFloat + isFinite pair in one place, with the rationale captured on the helper itself. The two call sites collapse to a single named call, and the surviving branches replace `Number.isFinite(...)` with `=== null` / `!== null` checks (functionally identical because the helper already filters non-finite values). Pure refactor -- emitted writes, the canOnlyGrow grow-only semantics, the post-resize "restore the px height after auto / external clears" verification, and the existing 5-test `useAutoResizeTextarea` suite (including the regression cases for capped large-text deletion and external inline-height clears added in #3263) are all unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Background
auto; if the measured height matches the cache, the old guard skipped restoring the pixel height. Large inputs then fell back to the CSS minimum until another resize path repaired them.Implementation
Validation
bun test src/browser/hooks/useAutoResizeTextarea.test.tsxmake static-checkRisks
Generated with
mux• Model:openai:gpt-5.5• Thinking:xhigh• Cost:1787684{MUX_COSTS_USD:-n/a}