Skip to content

Fix initial failed-send live region crash#5848

Merged
compulim merged 3 commits into
mainfrom
OEvgeny/fix-send-failed-live-region
Jul 14, 2026
Merged

Fix initial failed-send live region crash#5848
compulim merged 3 commits into
mainfrom
OEvgeny/fix-send-failed-live-region

Conversation

@OEvgeny

@OEvgeny OEvgeny commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #5812

Summary

  • Prevent LiveRegionSendFailed from dereferencing the unset initial value returned by usePrevious().
  • Treat a send failure already present at mount as an existing state, not a newly failed activity, so it is not announced.
  • Add a component-level regression test for an initially failed outgoing activity.

Validation

  • npm test -- --runInBand packages/component/src/Transcript/LiveRegion/SendFailed.spec.tsx
  • npm run precommit

Copilot AI review requested due to automatic review settings July 14, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a crash in the transcript live-region “send failed” announcer that could occur on first render when usePrevious() has not yet produced a value, and adds a regression test + changelog entry to document the fix.

Changes:

  • Guard LiveRegionSendFailed against the initial usePrevious() value to prevent dereferencing undefined.
  • Treat an already-failed outgoing activity at mount time as pre-existing (no announcement on mount).
  • Add a component-level regression test for the “failed at mount” scenario and document the fix in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/component/src/Transcript/LiveRegion/SendFailed.tsx Adds an initial-value guard to avoid crashing when comparing current vs previous failed-activity keys.
packages/component/src/Transcript/LiveRegion/SendFailed.spec.tsx Adds a regression test ensuring an initially failed send status does not cause an announcement/crash.
CHANGELOG.md Adds an Unreleased “Fixed” entry referencing issue #5812 and this PR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/component/src/Transcript/LiveRegion/SendFailed.tsx
Comment thread packages/component/src/Transcript/LiveRegion/SendFailed.spec.tsx Outdated
Comment thread packages/component/src/Transcript/LiveRegion/SendFailed.spec.tsx Outdated
@compulim compulim enabled auto-merge (squash) July 14, 2026 20:59
@compulim compulim merged commit b30fc6b into main Jul 14, 2026
59 of 60 checks passed
@compulim compulim deleted the OEvgeny/fix-send-failed-live-region branch July 14, 2026 21: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.

Undefined reference in SendFailed.tsx - TypeError: Cannot read properties of undefined (reading 'has')

3 participants