Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RoomEvent.Connected, fix connect future #431

Merged
merged 2 commits into from
Sep 12, 2022
Merged

Add RoomEvent.Connected, fix connect future #431

merged 2 commits into from
Sep 12, 2022

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Sep 9, 2022

Regarding the connect future fix, we've seen a couple of instances of b.reject is not defined when quickly connecting/disconnecting (one of these got raised with react's strict mode).
When constructing a future from a promise, previously there was no way to actually reject it from the future. This is fixed by not accepting a promise, but rather the function that runs within the promise in the future constructor.
Also removed the ! from the resolve and reject, as we cannot be sure those are actually populated.
In order to clean up stuff, there's an onFinally optional callback in the constructor.

@changeset-bot
Copy link

changeset-bot bot commented Sep 9, 2022

🦋 Changeset detected

Latest commit: 46ab7e4

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

This PR includes changesets to release 1 package
Name Type
livekit-client 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

@@ -171,7 +171,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
})
.on(EngineEvent.Resumed, () => {
this.setAndEmitConnectionState(ConnectionState.Connected);
this.reconnectFuture?.resolve();
this.reconnectFuture?.resolve?.();
Copy link
Member

Choose a reason for hiding this comment

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

ah ha, TIL!

@lukasIO lukasIO merged commit 4004426 into main Sep 12, 2022
@lukasIO lukasIO deleted the lukas/fix-future branch September 12, 2022 09:48
@github-actions github-actions bot mentioned this pull request Sep 12, 2022
max-b pushed a commit to Invisv-Privacy/client-sdk-js that referenced this pull request Oct 4, 2022
* add connected event, fix connect future

* changeset
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.

None yet

2 participants