Commit db97787
Fix all PR review comments: hooks rules, ESM import, timer cleanup, docs alignment
Addresses all 11 review comments from copilot-pull-request-reviewer:
1. Fix Rules of Hooks violation: lock mode on first render via useRef
instead of conditionally calling different hook implementations.
useChat is now always called (with /noop api in local mode).
2. Replace require('@ai-sdk/react') with static ESM import to avoid
runtime crashes in browser/ESM builds where require is undefined.
3. Include 'tool' in role union when converting initial messages for
useChat, matching the expanded ChatMessage.role type.
4. Fix onSend callback in API mode to include newly appended user
message in the messages array (consistent with local mode).
5. Add useEffect cleanup to cancel auto-response timer on unmount,
preventing state updates on unmounted components.
6. Fix clear() in local mode to cancel pending auto-response timer
by calling stop() before clearing messages.
7. Fix conversationId doc comment to say "x-conversation-id header"
matching the actual implementation.
8. Fix tool messages docs to accurately describe rendering behavior
(tool role messages render as assistant bubbles in current UI).
9. Fix AIWithToolCalls story comment to not imply UI display of
toolInvocations (metadata only, no dedicated rendering).
10. Remove duplicate "### Added" heading in CHANGELOG.md.
11. Remove avatar/avatarFallback from ChatMessage docs (not in types,
avatars are configured at Chatbot schema level). Added metadata
and timestamp type alignment with actual types.
Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/cbd1330e-479e-448d-a9b6-9e34df3edfb5
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>1 parent 42f6b4a commit db97787
File tree
6 files changed
+179
-187
lines changed- content/docs/plugins
- packages
- components/src/stories-json
- plugin-chatbot/src
- __tests__
- types/src
6 files changed
+179
-187
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
195 | | - | |
196 | | - | |
| 194 | + | |
| 195 | + | |
197 | 196 | | |
198 | 197 | | |
199 | 198 | | |
| |||
302 | 301 | | |
303 | 302 | | |
304 | 303 | | |
305 | | - | |
| 304 | + | |
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
12 | 29 | | |
13 | 30 | | |
14 | 31 | | |
| |||
295 | 312 | | |
296 | 313 | | |
297 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
298 | 346 | | |
299 | 347 | | |
0 commit comments