@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -195,22 +195,20 @@ export class StreamVideoClient {
195
195
 
196
196
  // The call might already be tracked by the client,
197
197
  // if `call.created` was received before `call.ring`.
198
- // In that case, we just reuse the already tracked call.
199
- let theCall = this.writeableStateStore.findCall(call.type, call.id);
200
- if (!theCall) {
201
- // otherwise, we create a new call
202
- theCall = new Call({
203
- streamClient: this.streamClient,
204
- type: call.type,
205
- id: call.id,
206
- members,
207
- clientStore: this.writeableStateStore,
208
- ringing: true,
209
- });
210
- }
211
-
198
+ // In that case, we cleanup the already tracked call.
199
+ const prevCall = this.writeableStateStore.findCall(call.type, call.id);
200
+ await prevCall?.leave();
201
+ // we create a new call
202
+ const theCall = new Call({
203
+ streamClient: this.streamClient,
204
+ type: call.type,
205
+ id: call.id,
206
+ members,
207
+ clientStore: this.writeableStateStore,
208
+ ringing: true,
209
+ });
212
210
  // we fetch the latest metadata for the call from the server
213
- await theCall.get({ ring: true });
211
+ await theCall.get();
214
212
  this.writeableStateStore.registerCall(theCall);
215
213
  }),
216
214
  );