Skip to content

fix(react): reset missing participant attributes - #1453

Open
fatihcvs wants to merge 1 commit into
livekit:mainfrom
fatihcvs:fix/participant-attribute-reset
Open

fatihcvs wants to merge 1 commit into
livekit:mainfrom
fatihcvs:fix/participant-attribute-reset

Conversation

@fatihcvs

Copy link
Copy Markdown

When useParticipantAttribute switches to a participant or key that does not have the requested attribute, it keeps returning the previous value. The observer's initial emission contains only attributes present on the new participant, so the changed-key filter never clears that stale state.

Reset the value from the current participant/key when the effect subscribes. Subsequent events still use the changed-key filter, and the previous subscription is cleaned up as before. Includes a React patch changeset.

Validation:

  • Two regressions fail before the fix (host instead of undefined) and pass after it: switching participant and switching attribute key.
  • Tests use real SDK Participant objects, updateInfo/AttributesChanged and the real hook in JSDOM. They also cover later updates, removal, ignoring old-participant events, switching back to a populated key and listener cleanup. No hook/observable mocks or server connection.
  • 120 React/core/styles tests pass. React build (three package tasks), React lint (existing warnings, no errors), repository format and React API checks pass.

Developed and verified with OpenAI Codex assistance.

@changeset-bot

changeset-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24ec2bc

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

This PR includes changesets to release 6 packages
Name Type
@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

@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

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.

1 participant