From 39c2d883758d7f6dfd1eec3f4233144715a086c3 Mon Sep 17 00:00:00 2001 From: avallete Date: Wed, 19 Mar 2025 12:42:01 +0100 Subject: [PATCH] fix(studio): delete all branches disabling branching --- .../interfaces/BranchManagement/BranchManagement.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx b/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx index 3928bea2096..d308142eba2 100644 --- a/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx +++ b/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx @@ -130,7 +130,13 @@ const BranchManagement = () => { const onConfirmDisableBranching = () => { if (projectRef == undefined) return console.error('Project ref is required') if (!previewBranches) return console.error('No branches available') - disableBranching({ projectRef, branchIds: previewBranches?.map((branch) => branch.id) }) + disableBranching({ + projectRef, + branchIds: previewBranches + // we can't delete the default branch it'll result in a permission error + ?.filter((branch) => branch.is_default === false) + .map((branch) => branch.id), + }) } if (!hasBranchEnabled) return