Skip to content

feat(apollo-react): run ApChat on ChatRoot with a Material renderer - #1298

Open
BenGSchulz wants to merge 1 commit into
feat/chat-message-renderersfrom
feat/chat-material-renderer
Open

BenGSchulz wants to merge 1 commit into
feat/chat-message-renderersfrom
feat/chat-material-renderer

Conversation

@BenGSchulz

@BenGSchulz BenGSchulz commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Runs the existing Material chat on ChatRoot and adds the ./chat ApChat (story MST-16176).

  • MaterialChatRenderer holds the Material UI: layouts, dropzone, the MUI theme map and enableInternalThemeProvider (now following the headless theme).
  • ApChat from ./ap-chat registers it and renders <ChatRoot defaultRenderer="material">, keeping ApChatProps. The duplicate provider stack is gone.
  • ApChat from ./chat defaults to the Wind renderer, for now a placeholder that names the missing renderer, and registers Material lazily: the single allowed src/chat → Material import, behind a documented biome-ignore (the rule does flag the dynamic import).

Fixes found along the way

  • Import cycle: attachments.tsx and six other chat components imported from the material barrels, which re-export ApChat, looping back into ap-chat.tsx. With registration at module load, the lazy ./chat path could register a half-loaded MaterialChatRenderer. They now import ApIcon / ApButton / ApTypography directly; ap-chat.js is no longer reachable from MaterialChatRenderer.js in dist.
  • First-frame theme: ThemeProvider takes initialTheme from ChatRoot, so the web component's internal MUI theme does not render one frame in the service default.
  • Renderer fallback: ChatRoot warns and uses defaultRenderer when config.renderer names an unregistered renderer (e.g. 'wind' on ./ap-chat).

Notes for reviewers

  • The Emotion styles move with the renderer unchanged. Migrating them to Tailwind would break Material consumers, who do not load the chat Tailwind CSS.
  • The Flow "AgentExperienceComposition" export is excluded from Storybook and rendered nowhere, so it could not be checked.
  • ./chat's initial load is about 960 KB unminified: 397 KB is canvas message catalogs (the shared i18n registry imports every catalog) and 151 KB is lodash/fp (one isEqual in the attachments provider). Worth trimming before Wind ships.

Verification

  • Visual parity: the repo has no Playwright setup, so I hashed each story's rendered DOM and Emotion CSS before and after. Showcase, Full Screen and Embedded are identical (hashes deterministic across runs).
  • Showcase harness: 17 controls (attachments, pre-hook, history, streaming, errors, mode switches) with no console errors
  • web-packages/ap-chat: builds; 42 tests pass; dev harness renders, dark theme applies, embedded mode renders in the shadow root, Emotion styles inject only into the shadow root
  • Bundle analysis (esbuild, splitting) of a ./chat consumer: 0 @mui/@emotion modules in the initial load; Material is a separate 4.8 MB lazy chunk
  • Emitted ApChat declarations unchanged apart from destructured parameter names; apollo-react tests: 3899 pass

Stack

Merge in order; each PR is based on the previous one.

  1. feat(apollo-react): wire the @uipath/apollo-react/chat subpath #1293 subpath wiring (MST-16174)
  2. refactor(apollo-react): move chat service and headless layer to src/chat #1294 move to src/chat (MST-16175)
  3. fix(apollo-react): give each chat service its own internal event bus #1295 instance isolation and publish (MST-16175)
  4. feat(apollo-react): add ChatRoot, renderer registry and renderer/density config #1296 ChatRoot and renderer registry (MST-16175)
  5. feat(apollo-react): resolve chat message renderers per chat renderer #1297 message renderers (MST-16175)
  6. feat(apollo-react): run ApChat on ChatRoot with a Material renderer #1298 Material renderer on ChatRoot (MST-16176) ← this PR

Plan: https://uipath.atlassian.net/wiki/spaces/CLD/pages/91226013878

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Dependency License Review

  • ✅ 1937 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1708
ISC 88
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.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.3 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

github-actions Bot commented Oct 7, 2026 •

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 50.5% 86.2% (25/29) 7.94 MB 31.17 MB +48.3 KB
@uipath/apollo-ui-icons — — 2.86 MB 6.97 MB ±0
@uipath/apollo-wind — — 678.6 KB 3.98 MB +14 B
@uipath/ap-chat 85.8% — 40.36 MB 45.56 MB −3.56 MB

"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.

The Material UI moves into MaterialChatRenderer (layouts, dropzone, MUI
theme map, enableInternalThemeProvider). ApChat from ./ap-chat now
registers it and renders ChatRoot with defaultRenderer="material",
keeping its props; rendered DOM and Emotion CSS are unchanged.

./chat exports an ApChat that defaults to the Wind renderer (for now a
placeholder) and registers Material lazily, the one allowed src/chat to
Material import. Its initial chunk carries no @mui or @emotion code.

ChatRoot falls back to defaultRenderer when config.renderer is not
registered, and passes the theme prop to ThemeProvider for the first
render so the internal MUI theme does not start in the service default.

Chat components now import ApIcon, ApButton and ApTypography directly
instead of through the material barrels, which re-export ApChat and
formed a cycle back into ap-chat.tsx.

MST-16176

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 17:09
@BenGSchulz
BenGSchulz force-pushed the feat/chat-material-renderer branch from 907773e to 3c59ab3 Compare October 7, 2026 17:09

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 reached their quota limit.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Oct 07, 2026, 10:17:24 AM
apollo-docs Ready Preview · Logs Oct 07, 2026, 10:17:24 AM
apollo-landing Ready Preview · Logs Oct 07, 2026, 10:17:24 AM
apollo-vertex Ready Preview · Logs Oct 07, 2026, 10:17:24 AM

@github-actions github-actions Bot added the size:XL 500-999 changed lines. label Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:apollo-react size:XL 500-999 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants