Repository navigation
fix(react-core): keep tool-call UIs mounted when capture reconnects - #7588
Conversation
…refs PE-506) The tool-call wrapper was keyed on the active Trajectory, so it appeared and disappeared on every capture start, connection failure and reconnect. The element type change remounted the tool UI and dropped local state of human-in-the-loop widgets. The wrapper now depends only on whether a learning config is set, exposed by Core as the internal ɵlearningConfigured getter with a matching subscription. Apps without learning keep rendering tool UIs without any wrapper. The useSyncExternalStore subscription is memoized instead of being recreated on every render.
…-506) A throwing listener used to skip the remaining ones and surface the error to the setLearningConfig caller. Each listener now runs in its own try/catch, like the other Core notifications.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: CopilotKit/CopilotKit/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: +621 B (+0.04%) Total Size: 1.76 MB 📦 View Changed
ℹ️ View Unchanged
|
8512f35
into
alem/pe-471-pair-on-browser-interaction-capture-experiments
What does this PR do?
Stacked on #7556. Keeps tool-call UIs mounted while capture connects, fails or reconnects.
The
data-tool-call-idwrapper inCopilotChatToolCallsViewwas tied tocopilotkit.trajectoryId. That value changes on start (after the Gateway join), on every connection failure and on reconnect. The view switched between returning the keyed renderer and a keyed<div>, so React remounted the tool UI each time and human-in-the-loop widgets lost their local state.learningconfig is set, via the internalɵlearningConfiguredgetter andɵsubscribeToLearningConfiguredon Core. Only adding or removing the config changes the tree.learningrender exactly as before: no wrapper.useSyncExternalStoresubscription is memoized instead of recreated on every render.Related PRs and Issues
Testing
pnpm nx run-many -t test,check-types --projects=@copilotkit/core,@copilotkit/react-core --skip-nx-cache: core 1142, react-core 1790 passed.null → id → null → id; an end-to-end wiring test through the mocked socket (join, lost connection, reconnect) keeps the same DOM node; no resubscribe on re-render; listener isolation.learningkeep the same node without a mismatch.Checklist