From 248e4c5d89f5fa42d2b16e3f7c07afd13ad56cd3 Mon Sep 17 00:00:00 2001 From: Sergei Shmakov Date: Mon, 23 Dec 2024 16:56:41 +0100 Subject: [PATCH] Reuses connected integrations by passing to getPullRequestIdentity... (#3788, #3795) --- src/plus/launchpad/launchpadProvider.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plus/launchpad/launchpadProvider.ts b/src/plus/launchpad/launchpadProvider.ts index ac63715a21684..3b065daeaf16b 100644 --- a/src/plus/launchpad/launchpadProvider.ts +++ b/src/plus/launchpad/launchpadProvider.ts @@ -214,14 +214,16 @@ export class LaunchpadProvider implements Disposable { } private async getSearchedPullRequests(search: string, cancellation?: CancellationToken) { - const prUrlIdentity: PullRequestUrlIdentity | undefined = await this.getPullRequestIdentityFromMaybeUrl(search); + const connectedIntegrations = await this.getConnectedIntegrations(); + const prUrlIdentity: PullRequestUrlIdentity | undefined = await this.getPullRequestIdentityFromMaybeUrl( + search, + connectedIntegrations, + ); const result: { readonly value: SearchedPullRequest[]; duration: number } = { value: [], duration: 0, }; - const connectedIntegrations = await this.getConnectedIntegrations(); - const findByPrIdentity = async ( integration: HostingIntegration, ): Promise> => { @@ -596,8 +598,10 @@ export class LaunchpadProvider implements Disposable { // - cons: it's async // What do you think? - async getPullRequestIdentityFromMaybeUrl(search: string): Promise { - const connectedIntegrations = await this.getConnectedIntegrations(); + async getPullRequestIdentityFromMaybeUrl( + search: string, + connectedIntegrations: Map, + ): Promise { for (const integrationId of supportedLaunchpadIntegrations) { if (connectedIntegrations.get(integrationId)) { const integration = await this.container.integrations.get(integrationId);