Skip to content

Commit

Permalink
Fixed an issue with removing message ids
Browse files Browse the repository at this point in the history
  • Loading branch information
jadahiya-MSFT committed May 10, 2024
1 parent 2b41e03 commit 7491372
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/teams-js/src/internal/communication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ function removeMessageHandlers(message: MessageResponse, map: Map<MessageUUID, F
}
if (!message.uuid) {
delete CommunicationPrivate.legacyMessageIdsToUuidMap[message.id];
} else {
//If we are here, then the parent is capable of sending UUIDs, therefore free up memory
CommunicationPrivate.legacyMessageIdsToUuidMap = {};
}
}

Expand Down Expand Up @@ -727,6 +730,9 @@ function handleParentMessage(evt: DOMMessageEvent): void {
logger('Removing registered port callback for message %i', callbackId);
removeMessageHandlers(message, CommunicationPrivate.portCallbacks);
}
if (message.uuid) {
CommunicationPrivate.legacyMessageIdsToUuidMap = {};
}
}
} else if ('func' in evt.data && typeof evt.data.func === 'string') {
// Delegate the request to the proper handler
Expand Down

0 comments on commit 7491372

Please sign in to comment.