diff --git a/src/script/team/TeamRepository.ts b/src/script/team/TeamRepository.ts index 0695438844f..ecced58edda 100644 --- a/src/script/team/TeamRepository.ts +++ b/src/script/team/TeamRepository.ts @@ -160,14 +160,17 @@ export class TeamRepository extends TypedEventEmitter { } private readonly scheduleTeamRefresh = (): void => { - window.setInterval(async () => { + const updateTeam = async () => { try { await this.getTeam(); await this.updateFeatureConfig(); } catch (error) { this.logger.error(error); } - }, TIME_IN_MILLIS.SECOND * 30); + }; + // We want to poll the latest team data every time the app is focused and every day + window.addEventListener('focus', updateTeam); + window.setInterval(updateTeam, TIME_IN_MILLIS.DAY); }; private async getInitialTeamMembers(teamId: string): Promise { diff --git a/src/script/util/DebugUtil.ts b/src/script/util/DebugUtil.ts index e23590e25aa..5bb1a2c68b3 100644 --- a/src/script/util/DebugUtil.ts +++ b/src/script/util/DebugUtil.ts @@ -280,6 +280,11 @@ export class DebugUtil { }); } + // Used by QA to trigger a focus event on the app (in order to trigger the update of the team feature-config) + simulateAppToForeground() { + window.dispatchEvent(new FocusEvent('focus')); + } + setE2EICertificateTtl(ttl: number) { E2EIHandler.getInstance().certificateTtl = ttl; }