Skip to content

Commit 7032fb0

Browse files
authored
docs: clarify AI migration composer hook usage (#3137)
### 🎯 Goal Clarify the AI migration guide so coding agents know when to use `useMessageComposerContext()` versus `useMessageComposerController()` during React v14 migrations. ### 🛠 Implementation details - document `useMessageComposerContext()` as the hook for rendered composer UI bindings - document `useMessageComposerController()` as the hook for the underlying `MessageComposer` controller and managers - recommend dedicated state hooks for simple reads before reaching into the controller directly ### 🎨 UI Changes None.
1 parent 6d04cdf commit 7032fb0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

ai-docs/ai-migration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ Removed override keys (no rename; redesign the surface): `EditMessageInput`, `Ed
236236

237237
After the `MessageInput*` → `MessageComposer*` rename (Phase 1):
238238

239+
- Use `useMessageComposerContext()` for component-level bindings exposed by the rendered composer UI, such as `handleSubmit`, paste handling, recording state, and refs.
240+
- Use `useMessageComposerController()` when the integration needs the underlying `MessageComposer` controller, such as `initState()`, `clear()`, `textComposer`, `attachmentManager`, `pollComposer`, or `linkPreviewsManager`.
241+
- Prefer dedicated state hooks for simple reads instead of reaching into the controller directly.
242+
239243
### `handleSubmit` signature
240244

241245
```tsx

0 commit comments

Comments
 (0)