Scoped use-propagate to individual Web Chat instances to prevent interference between multiple instances, in PR #5248, by @OEvgeny
Description
This PR addresses an issue where multiple Web Chat instances on the same page could interfere with each other due to shared use-propagate hook listeners. By introducing scopes for these hooks, we ensure that each Web Chat instance operates independently.
Design
This design decision encapsulates the scoping logic within the Web Chat's core structure, providing isolation for multiple instances while keeping the public API unchanged. The scopes were added to the ComposerCoreUI component specifically, as they are UI-related.
This placement allows the Composer component to be used as before without exposing scope components, maintaining backwards compatibility. We don't expose the scope components externally due to the lack of current use cases.
Specific Changes
Updated use-propagate to version 0.2.0-main.fb24772
Added FocusSendBoxScope and ScrollRelativeTranscriptScope to Composer
Modified sendBoxFocus.ts and transcriptScrollRelative.ts to export scope components
Updated related dependencies in package.json and package-lock.json
Added test for multiple WebChat instances
-
-
[x] I have added tests and executed them locally
[x] I have updated CHANGELOG.md
[x] ~I have updated documentation~
Review Checklist
This section is for contributors to review your work.
[x] ~Accessibility reviewed (tab order, content readability, alt text, color contrast)~
[x] ~Browser and platform compatibilities reviewed~
[x] ~CSS styles reviewed (minimal rules, no z-index)~
[x] ~Documents reviewed (docs, samples, live demo)~
[x] ~Internationalization reviewed (strings, unit formatting)~
[x] package.json and package-lock.json reviewed
[x] ~Security reviewed (no data URIs, check for nonce leak)~
Changelog Entry
use-propagate
to individual Web Chat instances to prevent interference between multiple instances, in PR #5248, by @OEvgenyDescription
This PR addresses an issue where multiple Web Chat instances on the same page could interfere with each other due to shared
use-propagate
hook listeners. By introducing scopes for these hooks, we ensure that each Web Chat instance operates independently.Design
This design decision encapsulates the scoping logic within the Web Chat's core structure, providing isolation for multiple instances while keeping the public API unchanged. The scopes were added to the
ComposerCoreUI
component specifically, as they are UI-related.This placement allows the Composer component to be used as before without exposing scope components, maintaining backwards compatibility. We don't expose the scope components externally due to the lack of current use cases.
Specific Changes
use-propagate
to version0.2.0-main.fb24772
FocusSendBoxScope
andScrollRelativeTranscriptScope
toComposer
sendBoxFocus.ts
andtranscriptScrollRelative.ts
to export scope componentspackage.json
andpackage-lock.json
-
-
CHANGELOG.md
Review Checklist
z-index
)~package.json
andpackage-lock.json
reviewed