@stream-io/video-client 1.40.2 → 1.40.3

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": "1.40.2",
3
+ "version": "1.40.3",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "browser": "dist/index.browser.es.js",
package/src/Call.ts CHANGED
@@ -1353,7 +1353,7 @@ export class Call {
1353
1353
 
1354
1354
  if (this.streamClient._hasConnectionID()) {
1355
1355
  this.watching = true;
1356
- this.clientStore.registerCall(this);
1356
+ this.clientStore.registerOrUpdateCall(this);
1357
1357
  }
1358
1358
 
1359
1359
  return joinResponse;
@@ -221,6 +221,32 @@ describe('StreamVideoClient Ringing', () => {
221
221
  expect(oliverClient.state.calls[0]).toBe(call);
222
222
  expect(call.ringing).toBe(true);
223
223
  });
224
+
225
+ it('new call instance with doJoinRequest({ ring: true }) should replace old instance in store', async () => {
226
+ const callId = crypto.randomUUID();
227
+
228
+ const call = oliverClient.call('default', callId, {
229
+ reuseInstance: true,
230
+ });
231
+ const callCreatedEvent = expectEvent(oliverClient, 'call.created');
232
+ const serverCall = serverClient.video.call('default', callId);
233
+ await serverCall.create({
234
+ data: {
235
+ created_by_id: 'oliver',
236
+ members: [{ user_id: 'oliver' }, { user_id: 'sacha' }],
237
+ },
238
+ });
239
+
240
+ // the event arrives and since the store is empty registers a new IDLE call
241
+ await callCreatedEvent;
242
+
243
+ // join registers or updates the call
244
+ await call.doJoinRequest({ ring: true });
245
+
246
+ expect(oliverClient.state.calls.length).toBe(1);
247
+ expect(oliverClient.state.calls[0]).toBe(call);
248
+ expect(oliverClient.state.calls[0].ringing).toBe(true);
249
+ });
224
250
  });
225
251
 
226
252
  describe('ringing interruption', () => {