Skip to content

Fixed batched livestream activities are not recognized in the same session#5440

Merged
OEvgeny merged 1 commit intomicrosoft:mainfrom
compulim:fix-batched-livestream
Mar 8, 2025
Merged

Fixed batched livestream activities are not recognized in the same session#5440
OEvgeny merged 1 commit intomicrosoft:mainfrom
compulim:fix-batched-livestream

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Mar 8, 2025

Fixes #5439.

Changelog Entry

Fixed

  • Fixed #5439. Fixed batched livestream activities are not recognized in the same session, in PR #XXX

Description

On every batch of incoming activities, activity keyer will recreate the keypair map.

Activity keyer will read from the old map and write to the new one. Writing to the new one ensures each render loop is clean of resource leak.

If activities are batched, activity keyer may not found the key as the key could be added in the same round.

This pull request fixed the activity keyer by reading from both new and old map.

Design

If unknown reasons, we cannot reproduce batched activities in the test suite. Or in other words, we do not know why the activities are batched.

We are using Redux store directly to inject activities, before Web Chat is mounted. So, first render will have 2 activities batched.

Specific Changes

  • Fixed ActivityKeyerComposer to read from both new and old map
  • 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)

@compulim compulim marked this pull request as ready for review March 8, 2025 00:40
(activityIdToKeyMap.get(typingActivityId) || nextActivityIdToKeyMap.get(typingActivityId))) ||
(activityId && (activityIdToKeyMap.get(activityId) || nextActivityIdToKeyMap.get(activityId))) ||
activityToKeyMap.get(activity) ||
nextActivityToKeyMap.get(activity) ||
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As expected next vs previous. Good thing it is now fixed!

@OEvgeny OEvgeny merged commit 8ab050b into microsoft:main Mar 8, 2025
25 checks passed
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.

Two batched incoming livestream activities should be identified as same session

2 participants