Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hudson-worden
Copy link
Contributor

Upon browser refresh we're hitting this error

https://github.com/livekit/client-sdk-js/blob/1a5a96638f42222eee323fb7947f0e336aa697fe/src/room/Room.ts#L292

we're using the useTextStream hook that was recently introduced. I believe there's a bug where when isDisconnected changes to true (upon browser refresh) then this memo runs again and it hits that invalid state.

@changeset-bot
Copy link

changeset-bot bot commented Apr 8, 2025

🦋 Changeset detected

Latest commit: 8a26836

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

This PR includes changesets to release 5 packages
Name Type
@livekit/components-react 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

@CLAassistant
Copy link

CLAassistant commented Apr 8, 2025

CLA assistant check
All committers have signed the CLA.

@lukasIO
Copy link
Contributor

lukasIO commented Apr 9, 2025

Thanks, this is indeed a bug, but I think we'd rather want to find a way to remove the isDisconnected dependency from the useMemo.

The main reason why it's in there is to reset the array after the room transitioned from a connected to a disconnected state.
Do you want to give that a try?

… removed unnecessary memoization of isDisconnected.
@hudson-worden
Copy link
Contributor Author

@lukasIO lmk if that latest commit is what you're suggesting. Tested it against our application and used the "Offline" feature of the Chrome network tab to try and simulate the disconnected flow you're mentioning.

Copy link
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

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

thanks, looking good apart from the nit with the import

@hudson-worden hudson-worden requested a review from lukasIO April 10, 2025 14:27
Copy link
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

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

thank you for the fix!

@lukasIO lukasIO merged commit 1c48a64 into livekit:main Apr 10, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Apr 10, 2025
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.

3 participants