From e926dc2de76b2d6dff58e25f8ab5c59bbed34f64 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Wed, 13 Aug 2025 17:48:08 +0200 Subject: [PATCH] frontend: update loadPreferences method to load room preferences and set feature configuration without caching --- .../lib/pages/meeting/meeting.component.ts | 3 +-- .../src/lib/services/room.service.ts | 23 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.ts index 1ea2379..04f2de4 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/meeting/meeting.component.ts @@ -257,7 +257,7 @@ export class MeetingComponent implements OnInit { try { await this.generateParticipantToken(); await this.addParticipantNameToUrl(); - await this.roomService.loadPreferences(this.roomId); + await this.roomService.loadRoomPreferences(this.roomId); this.showMeeting = true; // Subscribe to remote participants updates for showing/hiding the share meeting link component this.componentParticipantService.remoteParticipants$ @@ -332,7 +332,6 @@ export class MeetingComponent implements OnInit { if (topic === MeetSignalType.MEET_ROOM_PREFERENCES_UPDATED) { const { preferences } = event as MeetRoomPreferencesUpdatedPayload; this.featureConfService.setRoomPreferences(preferences); - // TODO: Update local state with new room preferences } else if (topic === MeetSignalType.MEET_PARTICIPANT_ROLE_UPDATED) { const { participantIdentity, newRole, secret } = event as MeetParticipantRoleUpdatedPayload; diff --git a/frontend/projects/shared-meet-components/src/lib/services/room.service.ts b/frontend/projects/shared-meet-components/src/lib/services/room.service.ts index d1710d2..675b421 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/room.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/room.service.ts @@ -18,7 +18,6 @@ export class RoomService { protected roomId: string = ''; protected roomSecret: string = ''; - protected roomPreferences?: MeetRoomPreferences; protected log; @@ -169,24 +168,16 @@ export class RoomService { } /** - * Loads the room preferences, either from cache or by fetching from the server. + * Loads the room preferences and updates the feature configuration service. * * @param roomId - The unique identifier of the room - * @param forceUpdate - Whether to force an update from the server - * @returns A promise that resolves to the MeetRoomPreferences object */ - async loadPreferences(roomId: string, forceUpdate: boolean = false): Promise { - if (this.roomPreferences && !forceUpdate) { - this.log.d('Returning cached room preferences'); - return this.roomPreferences; - } - + async loadRoomPreferences(roomId: string): Promise { this.log.d('Fetching room preferences from server'); try { - this.roomPreferences = await this.getRoomPreferences(roomId); - this.featureConfService.setRoomPreferences(this.roomPreferences); - console.log('Room preferences loaded:', this.roomPreferences); - return this.roomPreferences; + const preferences = await this.getRoomPreferences(roomId); + this.featureConfService.setRoomPreferences(preferences); + console.log('Room preferences loaded:', preferences); } catch (error) { this.log.e('Error loading room preferences', error); throw new Error('Failed to load room preferences'); @@ -194,8 +185,9 @@ export class RoomService { } /** - * Saves the room preferences. + * Saves new room preferences. * + * @param roomId - The unique identifier of the room * @param preferences - The room preferences to be saved. * @returns A promise that resolves when the preferences have been saved. */ @@ -203,7 +195,6 @@ export class RoomService { this.log.d('Saving room preferences', preferences); const path = `${this.ROOMS_API}/${roomId}`; await this.httpService.putRequest(path, preferences); - this.roomPreferences = preferences; } /**