Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 5cc7e05

Browse files
Merge pull request #717 from SuperViz/beta
Fix internal remove component remove flow
2 parents 6b9fe5f + 78dd4b6 commit 5cc7e05

File tree

5 files changed

+49
-20
lines changed

5 files changed

+49
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"yargs": "^17.7.2"
8383
},
8484
"dependencies": {
85-
"@superviz/socket-client": "1.8.0",
85+
"@superviz/socket-client": "1.8.2",
8686
"bowser": "^2.11.0",
8787
"bowser-jr": "^1.0.6",
8888
"debug": "^4.3.4",

src/components/video/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,25 @@ export class VideoConference extends BaseComponent {
525525
private onParticipantLeft = (_: Participant): void => {
526526
this.logger.log('video conference @ on participant left', this.localParticipant);
527527

528+
const { localParticipant, participants } = this.useStore(StoreType.GLOBAL);
529+
530+
localParticipant.publish({
531+
...localParticipant.value,
532+
activeComponents: localParticipant.value.activeComponents?.filter(
533+
(ac) => ac !== ComponentNames.VIDEO_CONFERENCE,
534+
),
535+
});
536+
537+
participants.publish({
538+
...participants.value,
539+
[this.localParticipant.id]: {
540+
...localParticipant.value,
541+
activeComponents: localParticipant.value.activeComponents?.filter(
542+
(ac) => ac !== ComponentNames.VIDEO_CONFERENCE,
543+
),
544+
},
545+
});
546+
528547
this.connectionService.removeListeners();
529548
this.publish(MeetingEvent.DESTROY);
530549
this.publish(MeetingEvent.MY_PARTICIPANT_LEFT, this.localParticipant);

src/core/launcher/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class Launcher extends Observable implements DefaultLauncher {
4747
localParticipant.publish({ ...participant });
4848
participants.subscribe(this.onParticipantListUpdate);
4949
isDomainWhitelisted.subscribe(this.onAuthentication);
50+
localParticipant.subscribe(this.onLocalParticipantUpdate);
5051

5152
group.publish(participantGroup);
5253
this.ioc = new IOC(localParticipant.value);
@@ -190,7 +191,7 @@ export class Launcher extends Observable implements DefaultLauncher {
190191
private canAddComponent = (component: Partial<BaseComponent>): boolean => {
191192
const isProvidedFeature = config.get<boolean>(`features.${component.name}`);
192193
const hasComponentLimit = LimitsService.checkComponentLimit(component.name);
193-
const isComponentActive = this.activeComponents.includes(component.name);
194+
const isComponentActive = this.activeComponents?.includes(component.name);
194195

195196
const verifications = [
196197
{
@@ -234,6 +235,16 @@ export class Launcher extends Observable implements DefaultLauncher {
234235
);
235236
};
236237

238+
private onLocalParticipantUpdate = (participant: Participant): void => {
239+
this.activeComponents = participant.activeComponents || [];
240+
241+
if (this.activeComponents.length) {
242+
this.activeComponentsInstances = this.activeComponentsInstances.filter((ac) => {
243+
return this.activeComponents.includes(ac.name);
244+
});
245+
}
246+
};
247+
237248
/**
238249
* @function onParticipantListUpdate
239250
* @description on participant list update

src/services/io/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class IOC {
2323
*/
2424
public destroy(): void {
2525
this.client.destroy();
26-
this.client.connection.off();
2726
}
2827

2928
/**
@@ -43,7 +42,7 @@ export class IOC {
4342

4443
if (
4544
needsToReconnectStates.includes(state.state) &&
46-
state.reason !== 'Unauthorized connection'
45+
!['io client disconnect', 'Unauthorized connection'].includes(state.reason)
4746
) {
4847
this.forceReconnect();
4948
}

yarn.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,18 +2666,18 @@
26662666
resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553"
26672667
integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==
26682668

2669-
"@superviz/[email protected].0":
2670-
version "1.8.0"
2671-
resolved "https://registry.yarnpkg.com/@superviz/socket-client/-/socket-client-1.8.0.tgz#6e21f177bc3f5ed128784f14a95a3c4f59d40593"
2672-
integrity sha512-+jTpYYug8rgugaoBvgfa3GU/zCSi00grwZzwCDZkLXTxil7e3psiZyRUYH9HucPRUT8ULgpplDN5MF9G43E/fQ==
2669+
"@superviz/[email protected].2":
2670+
version "1.8.2"
2671+
resolved "https://registry.yarnpkg.com/@superviz/socket-client/-/socket-client-1.8.2.tgz#054a19df95e144ae99f459ce75f38795feffbcb9"
2672+
integrity sha512-pB4Pq9GYL7iXFN5ppri9D5sG2ff5Yg/muBoT6pgW2scj91OL2741/ULuxcvTZiUtCW6H7ndHuplVMyHCczkIAA==
26732673
dependencies:
26742674
"@reactivex/rxjs" "^6.6.7"
2675-
debug "^4.3.4"
2675+
debug "^4.3.5"
26762676
lodash "^4.17.21"
26772677
rxjs "^7.8.1"
26782678
semantic-release-version-file "^1.0.2"
2679-
socket.io-client "^4.7.4"
2680-
zod "^3.22.4"
2679+
socket.io-client "^4.7.5"
2680+
zod "^3.23.8"
26812681

26822682
"@tootallnate/once@2":
26832683
version "2.0.0"
@@ -4776,7 +4776,7 @@ debug@^3.1.0, debug@^3.2.7:
47764776
dependencies:
47774777
ms "^2.1.1"
47784778

4779-
debug@^4.3.1:
4779+
debug@^4.3.1, debug@^4.3.5:
47804780
version "4.3.5"
47814781
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e"
47824782
integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==
@@ -9958,10 +9958,10 @@ smart-buffer@^4.2.0:
99589958
resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz"
99599959
integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==
99609960

9961-
socket.io-client@^4.7.4:
9962-
version "4.7.4"
9963-
resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.4.tgz#5f0e060ff34ac0a4b4c5abaaa88e0d1d928c64c8"
9964-
integrity sha512-wh+OkeF0rAVCrABWQBaEjLfb7DVPotMbu0cgWgyR0v6eA4EoVnAwcIeIbcdTE3GT/H3kbdLl7OoH2+asoDRIIg==
9961+
socket.io-client@^4.7.5:
9962+
version "4.7.5"
9963+
resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.5.tgz#919be76916989758bdc20eec63f7ee0ae45c05b7"
9964+
integrity sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==
99659965
dependencies:
99669966
"@socket.io/component-emitter" "~3.1.0"
99679967
debug "~4.3.2"
@@ -11301,7 +11301,7 @@ yoctocolors@^2.0.0:
1130111301
resolved "https://registry.yarnpkg.com/yoctocolors/-/yoctocolors-2.0.2.tgz#8e871e30d7eabb1976776e07a9fe2fe9a8c46fba"
1130211302
integrity sha512-Ct97huExsu7cWeEjmrXlofevF8CvzUglJ4iGUet5B8xn1oumtAZBpHU4GzYuoE6PVqcZ5hghtBrSlhwHuR1Jmw==
1130311303

11304-
zod@^3.22.4:
11305-
version "3.22.4"
11306-
resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff"
11307-
integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==
11304+
zod@^3.23.8:
11305+
version "3.23.8"
11306+
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
11307+
integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==

0 commit comments

Comments
 (0)