Repository navigation
fix: keep the composer's focus when the chat view leaves its zero state - #52
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughFlowChatView now uses the same keyed composer subtree in its wide empty-state and docked layouts. The changelog states that this preserves composer state and focus when leaving the wide zero state. ChangesComposer state across layouts
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The supplied review context identifies no actionable merge-blocking risk in the composer layout change. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
On wide layouts,
FlowChatViewputs the composer in the centred cluster while the conversation is empty, and docks it at the bottom edge once there are messages. Nothing carried the composer between the two places, so the first send rebuilt it from scratch and the field lost focus: text typed straight after the first message went nowhere. Sends from the docked composer were unaffected.The view now holds a
GlobalKeyand wraps the composer in aKeyedSubtreein both places, so the element moves instead of remounting, keeping its focus and the rest of its state. A host's own key on its composer still works, since theKeyedSubtreewraps it rather than replacing it.This is also groundwork for #46: the composer's send animations need it to survive its first send.
Verified
mainit went nowhere. No framework errors in the console.dart run melos run analyzeis clean in every workspace member.Note
Low Risk
Narrow layout/identity fix in FlowChatView with no auth, data, or API surface changes.
Overview
Fixes composer focus loss on the first send in wide layouts: when
FlowChatViewswitches from the centred empty-state cluster to the bottom-docked composer, Flutter used to mount a new element and the text field dropped focus.FlowChatViewnow keeps aGlobalKeyand wraps the hostcomposerinKeyedSubtreein both_emptyCentreand_composerZone, so the same subtree moves instead of remounting—preserving focus, draft, and internal state. Host keys on the composer still apply because the subtree wraps the child rather than replacing it. The CHANGELOG documents the behaviour for 0.4.0.Reviewed by Cursor Bugbot for commit a9c5626. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit