@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.cjs.js CHANGED
@@ -11007,7 +11007,7 @@ class StreamClient {
11007
11007
  }
11008
11008
  getUserAgent() {
11009
11009
  return (this.userAgent ||
11010
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.11"}`);
11010
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.12"}`);
11011
11011
  }
11012
11012
  setUserAgent(userAgent) {
11013
11013
  this.userAgent = userAgent;
@@ -11333,21 +11333,20 @@ class StreamVideoClient {
11333
11333
  }
11334
11334
  // The call might already be tracked by the client,
11335
11335
  // if `call.created` was received before `call.ring`.
11336
- // In that case, we just reuse the already tracked call.
11337
- let theCall = this.writeableStateStore.findCall(call.type, call.id);
11338
- if (!theCall) {
11339
- // otherwise, we create a new call
11340
- theCall = new Call({
11341
- streamClient: this.streamClient,
11342
- type: call.type,
11343
- id: call.id,
11344
- members,
11345
- clientStore: this.writeableStateStore,
11346
- ringing: true,
11347
- });
11348
- }
11336
+ // In that case, we cleanup the already tracked call.
11337
+ const prevCall = this.writeableStateStore.findCall(call.type, call.id);
11338
+ yield (prevCall === null || prevCall === void 0 ? void 0 : prevCall.leave());
11339
+ // we create a new call
11340
+ const theCall = new Call({
11341
+ streamClient: this.streamClient,
11342
+ type: call.type,
11343
+ id: call.id,
11344
+ members,
11345
+ clientStore: this.writeableStateStore,
11346
+ ringing: true,
11347
+ });
11349
11348
  // we fetch the latest metadata for the call from the server
11350
- yield theCall.get({ ring: true });
11349
+ yield theCall.get();
11351
11350
  this.writeableStateStore.registerCall(theCall);
11352
11351
  })));
11353
11352
  return connectUserResponse;