From 530f246eb6ec8097e99d6d006f90e250a05c466f Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 15 Jul 2024 10:57:24 -0300 Subject: [PATCH 1/2] fix: don't force to reconnect when the client closes the connection --- src/services/io/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/io/index.ts b/src/services/io/index.ts index a01b69ed..97d52aec 100644 --- a/src/services/io/index.ts +++ b/src/services/io/index.ts @@ -23,7 +23,6 @@ export class IOC { */ public destroy(): void { this.client.destroy(); - this.client.connection.off(); } /** @@ -43,7 +42,7 @@ export class IOC { if ( needsToReconnectStates.includes(state.state) && - state.reason !== 'Unauthorized connection' + !['io client disconnect', 'Unauthorized connection'].includes(state.reason) ) { this.forceReconnect(); } From 65edd57c051fdbd2b4eee445ed728268f0406cbd Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 15 Jul 2024 10:58:29 -0300 Subject: [PATCH 2/2] fix: remove activeComponents duplication and sync the store list witn core list --- src/core/launcher/index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/launcher/index.ts b/src/core/launcher/index.ts index 3738f2f3..e2f05128 100644 --- a/src/core/launcher/index.ts +++ b/src/core/launcher/index.ts @@ -47,6 +47,7 @@ export class Launcher extends Observable implements DefaultLauncher { localParticipant.publish({ ...participant }); participants.subscribe(this.onParticipantListUpdate); isDomainWhitelisted.subscribe(this.onAuthentication); + localParticipant.subscribe(this.onLocalParticipantUpdate); group.publish(participantGroup); this.ioc = new IOC(localParticipant.value); @@ -188,11 +189,9 @@ export class Launcher extends Observable implements DefaultLauncher { * @returns {boolean} */ private canAddComponent = (component: Partial): boolean => { - const { localParticipant } = useStore(StoreType.GLOBAL); - const isProvidedFeature = config.get(`features.${component.name}`); const hasComponentLimit = LimitsService.checkComponentLimit(component.name); - const isComponentActive = localParticipant.value.activeComponents?.includes(component.name); + const isComponentActive = this.activeComponents?.includes(component.name); const verifications = [ { @@ -236,6 +235,16 @@ export class Launcher extends Observable implements DefaultLauncher { ); }; + private onLocalParticipantUpdate = (participant: Participant): void => { + this.activeComponents = participant.activeComponents || []; + + if (this.activeComponents.length) { + this.activeComponentsInstances = this.activeComponentsInstances.filter((ac) => { + return this.activeComponents.includes(ac.name); + }); + } + }; + /** * @function onParticipantListUpdate * @description on participant list update