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

Commit 78dd4b6

Browse files
Merge pull request #716 from SuperViz/fix/active-components-lists
fix: active components lists
2 parents d87ab32 + 65edd57 commit 78dd4b6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/core/launcher/index.ts

Lines changed: 12 additions & 3 deletions
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);
@@ -188,11 +189,9 @@ export class Launcher extends Observable implements DefaultLauncher {
188189
* @returns {boolean}
189190
*/
190191
private canAddComponent = (component: Partial<BaseComponent>): boolean => {
191-
const { localParticipant } = useStore(StoreType.GLOBAL);
192-
193192
const isProvidedFeature = config.get<boolean>(`features.${component.name}`);
194193
const hasComponentLimit = LimitsService.checkComponentLimit(component.name);
195-
const isComponentActive = localParticipant.value.activeComponents?.includes(component.name);
194+
const isComponentActive = this.activeComponents?.includes(component.name);
196195

197196
const verifications = [
198197
{
@@ -236,6 +235,16 @@ export class Launcher extends Observable implements DefaultLauncher {
236235
);
237236
};
238237

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+
239248
/**
240249
* @function onParticipantListUpdate
241250
* @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
}

0 commit comments

Comments
 (0)