mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
69441ccfa4
## What does this PR do? Fixes the v1 compatibility render path so an assistant message can render every tool call instead of only `toolCalls[0]`. The returned lazy renderer now: - matches each tool call with its corresponding tool result; - renders all registered tool-call renderers in one fragment; - removes `null` render results and returns `null` when no tool has a renderer. Keeping the fragment behind the existing lazy-renderer callback preserves the exported `useLazyToolRenderer` return signature. Filtering before returning also avoids attaching empty generative UI, so caller-provided subcomponents are not suppressed when no renderer is registered. Regression tests cover multiple tool calls, per-call result matching, the all-unhandled case, and a mixed handled/unhandled message. ## Related PRs and Issues - Fixes #2946 ## Verification - `pnpm nx run @copilotkit/react-core:test` (133 files, 1,530 Vitest tests plus 47 script tests) - `pnpm nx run @copilotkit/react-core:check-types` - `pnpm exec oxfmt --check packages/react-core/src/v1-deprecated/hooks/use-lazy-tool-renderer.tsx packages/react-core/src/v1-deprecated/hooks/__tests__/use-lazy-tool-renderer.test.tsx` ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] Documentation is unchanged because this restores existing v1 behavior without changing the public API - [x] "Allow edits by maintainers" is checked