Fix draft title truncated to one line when opened from sidebar#237
Merged
Conversation
The title textarea height-calc effect depended only on `titleInput`.
When opening a draft, `titleInput` is initialised from the `title` prop
while the textarea is still unmounted (status='loading'). Once the async
load completes, `setTitleInput(result.title)` is usually the same string
— React sees no dep change, the effect never re-fires, and the textarea
stays at `rows={1}`.
Adding `state.status` to the dep array ensures the effect runs when the
textarea enters the DOM (status changes to 'ready').
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a Draft Editor UI rendering bug where long draft titles could remain visually truncated to a single line when opening a draft from the sidebar, due to the title textarea auto-height effect not re-running when the editor transitions from loading to ready.
Changes:
- Update the title textarea height-adjustment
useEffectdependencies to includestate.status, ensuring the effect re-runs when the textarea is conditionally mounted.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
<textarea>height-calcuseEffectonly depended ontitleInput. The textarea is conditionally rendered (only whenstate.status === 'ready'), buttitleInputis initialized from thetitleprop while status is still'loading'. When the async load completes,setTitleInput(result.title)is the same string — React sees no dep change, the effect never re-fires, and the textarea stays atrows={1}.state.statusto the effect's dependency array so the height calc re-runs when the textarea enters the DOM.Test plan
🤖 Generated with Claude Code