From 01408f7e560fa2920116b06391fbb2c71b5d06e4 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Fri, 10 Nov 2023 10:27:26 +0800 Subject: [PATCH] Integrate updated GH PR endpoint (#18774) * Integrate updated GH PR endpoint * Address comments --- .../BranchManagement/BranchManagement.tsx | 6 ++- .../BranchManagement/BranchPanels.tsx | 1 + studio/data/api.d.ts | 39 ------------------- ...integrations-github-pull-requests-query.ts | 22 ++++++----- studio/data/integrations/keys.ts | 12 +----- 5 files changed, 21 insertions(+), 59 deletions(-) diff --git a/studio/components/interfaces/BranchManagement/BranchManagement.tsx b/studio/components/interfaces/BranchManagement/BranchManagement.tsx index f846b7c3241..43747e3daad 100644 --- a/studio/components/interfaces/BranchManagement/BranchManagement.tsx +++ b/studio/components/interfaces/BranchManagement/BranchManagement.tsx @@ -70,6 +70,10 @@ const BranchManagement = () => { } = useBranchesQuery({ projectRef }) const [[mainBranch], previewBranches] = partition(branches, (branch) => branch.is_default) const branchesWithPRs = previewBranches.filter((branch) => branch.pr_number !== undefined) + const prNumbers = + branches !== undefined + ? (branchesWithPRs.map((branch) => branch.pr_number).filter(Boolean) as number[]) + : undefined const githubIntegration = integrations?.find( (integration) => @@ -92,7 +96,7 @@ const BranchManagement = () => { organizationIntegrationId: githubIntegration?.id, repoOwner, repoName, - target: mainBranch?.git_branch, + prNumbers, }) const pullRequests = allPullRequests ?? [] diff --git a/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/studio/components/interfaces/BranchManagement/BranchPanels.tsx index 47d0597a03c..d8ab75c738c 100644 --- a/studio/components/interfaces/BranchManagement/BranchPanels.tsx +++ b/studio/components/interfaces/BranchManagement/BranchPanels.tsx @@ -139,6 +139,7 @@ export const BranchRow = ({ )} + {isMain ? (