Repository navigation
Stop updating other components while rendering - #5958
Merged
Merged
Conversation
added 5 commits
October 22, 2026 04:44
…edged state useLiveRegion and the typing indicator queued live region nodes in useMemo, the "New messages" button marked activities as read and the transcript marked them as acknowledged in useMemo. React development builds log "Cannot update a component while rendering a different component" for each. Move the updates into layout effects (still before paint) and queue a live region node once per deps change, also in Strict Mode.
Part grouping registers itself while rendering and its activities read their group while rendering. The map was also kept in a state that was never read, so the registration updated <ActivityLogicalGroupingComposer> while rendering.
…component" in tests
…ut effects re-render A rehydrated store has activities before the graph is created, but the graph only added them on the next dispatch, and <GraphProvider> synchronized in a passive effect. Queuing the rehydrated notification to the live region in a layout effect re-renders the transcript (useActivities) after passive effects but before the graph state update, and the development assertion found 0 activities in the graph and 1 in Redux. - createGraphFromStore: add the store's activities when the graph is created - GraphProvider: subscribe and synchronize in a layout effect, so the graph state is updated in the same render as other layout effect updates
Eugene (OEvgeny)
marked this pull request as ready for review
October 22, 2026 16:02
Eugene (OEvgeny)
requested review from
William Wong (compulim),
Chris Whitten (cwhitten) and
TJ Durnford (tdurnford)
as code owners
October 22, 2026 16:02
William Wong (compulim)
approved these changes
Oct 22, 2026
2 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Entry
Fixed
Description
Web Chat updated the live region, read/acknowledged state and part grouping from
useMemowhile rendering other components. They now update in layout effects, before paint as before, and the harness fails on the warning.Design
Specific Changes
useLiveRegion: layout effect, once per deps changeLiveRegionTranscript: typing usesuseLiveRegionScrollToEndButton,InternalTranscriptScrollable: mark read/acknowledged in layout effectsActivityLogicalGroupingComposer: ref, no unread statecreateGraphFromStore,GraphProvider: add rehydrated activities on creation, sync in a layout effectdone.js,hideKnownError.js, 2 tests: stop ignoring ittoast/noUpdateWhileRendering.html: snapshot 1, toast announcedscrollToEndButton.noUpdateWhileRendering.html: snapshot 1, "Message 6." focusedtypingIndicator.liveRegion.noUpdateWhileRendering.html: snapshot 1, "Bot is typing." announced.changelog/<PR#>-<slug>.mdReview Checklist
z-index)package.jsonandpackage-lock.jsonreviewed