diff --git a/packages/beacon-dapp/src/dapp-client/DAppClient.ts b/packages/beacon-dapp/src/dapp-client/DAppClient.ts index 678c25d89..5ff2160e0 100644 --- a/packages/beacon-dapp/src/dapp-client/DAppClient.ts +++ b/packages/beacon-dapp/src/dapp-client/DAppClient.ts @@ -388,7 +388,9 @@ export class DAppClient extends Client { } else if (typedMessage.type === BeaconMessageType.ChangeAccountRequest) { await this.onNewAccount(typedMessage as ChangeAccountRequest, connectionInfo) } else { - logger.error('handleResponse', 'no request found for id ', message.id, message) + // This needs to be a debug log because, due to the BC feature, + // IDs generated in another tab will also be handled here. + logger.debug('handleResponse', 'no request found for id ', message.id, message) } } @@ -492,8 +494,7 @@ export class DAppClient extends Client { case BeaconMessageType.PermissionRequest: case BeaconMessageType.OperationRequest: case BeaconMessageType.SignPayloadRequest: - this.openRequestsOtherTabs.add(message.id) - this.makeRequest(message.data, false, message.id) + this.prepareRequest(message) break case 'RESPONSE': this.handleResponse(message.data.message, message.data.connectionInfo) @@ -506,6 +507,15 @@ export class DAppClient extends Client { } } + private prepareRequest(message: any) { + if (!this.multiTabChannel.isLeader()) { + return + } + + this.openRequestsOtherTabs.add(message.id) + this.makeRequest(message.data, false, message.id) + } + private async createStateSnapshot() { if (!localStorage || !this.enableMetrics) { return