Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: scope use-propagate to a single Web Chat instance #5248

Merged
merged 4 commits into from
Aug 5, 2024

Conversation

OEvgeny
Copy link
Collaborator

@OEvgeny OEvgeny commented Jul 23, 2024

Related to #5150.

Fixes #

Changelog Entry

  • 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

-

  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@OEvgeny OEvgeny marked this pull request as ready for review July 23, 2024 22:44
@compulim compulim changed the title fix: scope use-propagate to a single webchat instance fix: scope use-propagate to a single Web Chat instance Jul 23, 2024
@compulim compulim merged commit c312f7f into main Aug 5, 2024
25 checks passed
@compulim compulim deleted the fix/use-propagate-usage branch August 5, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants