Skip to content

fix(core): keep sending state active during overlapping sends - #1462

Draft
drewsephski wants to merge 1 commit into
livekit:mainfrom
drewsephski:fix/overlapping-send-state
Draft

drewsephski wants to merge 1 commit into
livekit:mainfrom
drewsephski:fix/overlapping-send-state

Conversation

@drewsephski

Copy link
Copy Markdown

When two calls to the same chat or data-channel send() overlap, finishing either call sets isSending to false while the other call is still pending. Consumers such as the documented useChat example can therefore re-enable their send button too early. A rejected send has the same effect.

Track the number of pending sends within each setup instance and derive the completion state from that count. Chat sends remain pending through both sendText and the legacy publish. Include a patch changeset for @livekit/components-core.

Reproduction before the fix

Added and ran the regression tests against unmodified production code at 6b9bc6ee1065221f74093f15be395439d6dba45f:

pnpm --filter @livekit/components-core test src/components/chat.test.ts src/observables/dataChannel.test.ts

All six new cases failed with expected false to be true after settling the first send while holding the second send pending; the three existing data-channel cases passed. Deferred SDK method spies cover successful and failed text sends, successful and failed legacy publishes, data-channel success/failure, and subscribers joining while a send remains pending.

Local validation after the fix

  • pnpm --filter @livekit/components-core test — 117 tests passed.
  • pnpm test — all repository test tasks passed.
  • pnpm lint and pnpm format:check — passed.
  • pnpm build:core and pnpm build — passed.
  • pnpm api:check — passed; the repository explicitly disables the core API check, and the React API extractor completed successfully.
  • git diff --cached --check — passed before committing.

AI assistance: Codex helped investigate, implement, and run the local checks described above. Opening as a draft for review.

@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

@drewsephski is attempting to deploy a commit to the LiveKit Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Oct 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@changeset-bot

changeset-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6b42a1c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@livekit/components-core Patch
@livekit/components-react Patch
@livekit/agents-ui Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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