Repository navigation
fix(apollo-react): show chat history and messages the host sets while the chat is mounting - #1569
Conversation
…mounting [MST-18207] useChatHistory seeded its list from the service during render but only subscribed to SetHistory and ShouldShowLoadingMoreHistory in a passive effect. A setHistory landing in between was stored on the service and never reached the list, which stayed empty until the next update. CAS hits this with the Wind renderer: the widget mounts the chat and fetches the first history page in the same commit, and the lazy renderer behind Suspense gives the fetch time to resolve before the effect runs. History then only appeared after the first message. The effect now re-reads the service's history and "has more" right after subscribing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s mounting [MST-18207] useChatMessages seeded the transcript from the service during render but only subscribed to SetConversation, Request, Response and NewChat in a passive effect. A change landing in between was stored on the service and never reached the transcript. The hook mounts inside the lazy renderer behind Suspense, where React 19 can hold the effect back. The effect now re-reads the service's conversation right after subscribing, as the history hook and the suggestions state already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dependency License Review
License distribution
Excluded packages
|
Storybook visual diffBaseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs Updated (PT): Nov 12, 2026, 10:53:17 AM |
📊 Coverage + size by packagePer-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.
"Coverage" is each package's own |
Summary
CAS reported that, on Alpha with the Wind renderer, an agent's history panel showed "There are no conversations yet." until the first message was sent (MST-18207, Slack). The widget loads history correctly; the chat dropped it.
1. History set while the chat mounts is shown (
fix)useChatHistoryseeded its list fromgetHistory()during render but subscribed toSetHistoryandShouldShowLoadingMoreHistoryin a passive effect. AsetHistorylanding in between was stored on the service and never reached the list, so it stayed empty, with a stale "has more", until the nextsetHistory.uipath-ui-widgetsmounts<ApChat>and fetches the first history page in the same commit. Wind is lazy-loaded behind Suspense, and React 19 can hold the reveal (and the effects) back long enough for the fetch to resolve in that gap. On the first message the widget pushes its own copy again ([newConversation, ...pastConversations]), which is why history then appeared, ending in a "loading more" spinner.The effect now re-reads the service's history and "has more" right after subscribing. Material shares the hook, so it gets the fix too.
2. A conversation set while the chat mounts is shown (
fix)useChatMessageshad the same shape: seeded fromgetConversation()in render, subscribed toSetConversation,Request,ResponseandNewChatin an effect. It now re-reads the conversation after subscribing, the same way. The service stores the whole transcript and the hook changes nothing before subscribing, so the re-read gives what the seed would have been at that moment (fake streaming stripped, as on mount). CAS does not hit this one today, since it sets the conversation before mounting the chat.AutopilotChatStateProvideralready catches up on suggestions this way. Its other values are left as they are: it mounts inChatRootoutside the Suspense boundary, and hosts set them through config before mounting.Testing
setHistory/setConversationbefore effects run. Both failed before the fix. The history test also checks that a "done" set in the gap stops the short list from asking for more.src/chatrun has the same failures locally with and without this change (Material-renderer suites that do not load under local vitest).🤖 Generated with Claude Code