@stream-io/video-client 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -11006,7 +11006,7 @@ class StreamClient {
11006
11006
  }
11007
11007
  getUserAgent() {
11008
11008
  return (this.userAgent ||
11009
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.11"}`);
11009
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.12"}`);
11010
11010
  }
11011
11011
  setUserAgent(userAgent) {
11012
11012
  this.userAgent = userAgent;
@@ -11332,21 +11332,20 @@ class StreamVideoClient {
11332
11332
  }
11333
11333
  // The call might already be tracked by the client,
11334
11334
  // if `call.created` was received before `call.ring`.
11335
- // In that case, we just reuse the already tracked call.
11336
- let theCall = this.writeableStateStore.findCall(call.type, call.id);
11337
- if (!theCall) {
11338
- // otherwise, we create a new call
11339
- theCall = new Call({
11340
- streamClient: this.streamClient,
11341
- type: call.type,
11342
- id: call.id,
11343
- members,
11344
- clientStore: this.writeableStateStore,
11345
- ringing: true,
11346
- });
11347
- }
11335
+ // In that case, we cleanup the already tracked call.
11336
+ const prevCall = this.writeableStateStore.findCall(call.type, call.id);
11337
+ yield (prevCall === null || prevCall === void 0 ? void 0 : prevCall.leave());
11338
+ // we create a new call
11339
+ const theCall = new Call({
11340
+ streamClient: this.streamClient,
11341
+ type: call.type,
11342
+ id: call.id,
11343
+ members,
11344
+ clientStore: this.writeableStateStore,
11345
+ ringing: true,
11346
+ });
11348
11347
  // we fetch the latest metadata for the call from the server
11349
- yield theCall.get({ ring: true });
11348
+ yield theCall.get();
11350
11349
  this.writeableStateStore.registerCall(theCall);
11351
11350
  })));
11352
11351
  return connectUserResponse;