Skip to content

fix(apollo-react): show chat history and messages the host sets while the chat is mounting - #1569

Merged
BenGSchulz merged 2 commits into
mainfrom
fix/chat-history-set-while-mounting
Nov 12, 2026
Merged

BenGSchulz merged 2 commits into
mainfrom
fix/chat-history-set-while-mounting

Conversation

@BenGSchulz

@BenGSchulz BenGSchulz commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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)

useChatHistory seeded its list from getHistory() during render but subscribed to SetHistory and ShouldShowLoadingMoreHistory in a passive effect. A setHistory landing in between was stored on the service and never reached the list, so it stayed empty, with a stale "has more", until the next setHistory.

uipath-ui-widgets mounts <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)

useChatMessages had the same shape: seeded from getConversation() in render, subscribed to SetConversation, Request, Response and NewChat in 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.

AutopilotChatStateProvider already catches up on suggestions this way. Its other values are left as they are: it mounts in ChatRoot outside the Suspense boundary, and hosts set them through config before mounting.

Testing

  • Unit tests: a sibling that renders after the hook calls setHistory / setConversation before 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.
  • Biome and tsc are clean.
  • The full src/chat run has the same failures locally with and without this change (Material-renderer suites that do not load under local vitest).
  • Not verified in the CAS widget against Alpha.

🤖 Generated with Claude Code

BenGSchulz and others added 2 commits November 12, 2026 10:40
…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>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 18:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added size:L 100-499 changed lines. pkg:apollo-react labels Nov 12, 2026
@github-actions
github-actions Bot temporarily deployed to preview/apollo-vertex November 12, 2026 18:42 Destroyed
@github-actions
github-actions Bot temporarily deployed to preview/apollo-landing November 12, 2026 18:42 Destroyed
@github-actions
github-actions Bot temporarily deployed to preview/apollo-design November 12, 2026 18:42 Destroyed
@github-actions
github-actions Bot temporarily deployed to preview/apollo-docs November 12, 2026 18:42 Destroyed
@github-actions

Copy link
Copy Markdown
Contributor

Dependency License Review

  • ✅ 1958 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1722
ISC 91
Apache-2.0 57
BSD-3-Clause 28
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
CC0-1.0 4
MIT-0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.3.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

@github-actions

Copy link
Copy Markdown
Contributor

Storybook visual diff

⚠️ Visual changes detected: 2 changed (of 8 compared, 6 unchanged). View report

Baseline 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

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core — — 42.02 MB 50.17 MB ±0
@uipath/apollo-react 59.8% 100.0% (3/3) 2.49 MB 14.02 MB +49 B
@uipath/apollo-ui-icons — — 2.86 MB 6.97 MB ±0
@uipath/apollo-vertex — — — — —
@uipath/apollo-wind — — 897.6 KB 5.07 MB −3 B
@uipath/ap-chat 85.8% — 40.48 MB 46.10 MB +33 B

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

@BenGSchulz
BenGSchulz merged commit 8f4cdad into main Nov 12, 2026
37 of 38 checks passed
@BenGSchulz
BenGSchulz deleted the fix/chat-history-set-while-mounting branch November 12, 2026 22:07

This branch was successfully deployed

No deployments
preview/apollo-docs — 3bb46f77 Deployed Nov 12, 2026 by github-actions[bot]
preview/apollo-design — 3bb46f77 Deployed Nov 12, 2026 by github-actions[bot]
preview/apollo-landing — 3bb46f77 Deployed Nov 12, 2026 by github-actions[bot]
preview/apollo-vertex — 3bb46f77 Deployed Nov 12, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:apollo-react size:L 100-499 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants