From 268c29cd9dca32ebfcbc5c93c84801cfdd48619b Mon Sep 17 00:00:00 2001
From: Andrew Valleteau
Date: Fri, 24 Oct 2025 18:25:16 +0200
Subject: [PATCH] feat(studio): give action shortcut for persistent branches
deletion (#39786)
* feat(studio): give action shortcut for persistent branches deletion
* chore: refactor dedup trigger
* chore: no-biome
---
.../interfaces/BranchManagement/Overview.tsx | 38 +++++++++++++++----
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/apps/studio/components/interfaces/BranchManagement/Overview.tsx b/apps/studio/components/interfaces/BranchManagement/Overview.tsx
index 666cf7445c6..4f9f6f047b9 100644
--- a/apps/studio/components/interfaces/BranchManagement/Overview.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/Overview.tsx
@@ -180,9 +180,14 @@ const PreviewBranchActions = ({
const { data } = useBranchQuery({ projectRef, branchRef })
const isBranchActiveHealthy = data?.status === 'ACTIVE_HEALTHY'
+ const isPersistentBranch = branch.persistent
const [showConfirmResetModal, setShowConfirmResetModal] = useState(false)
const [showBranchModeSwitch, setShowBranchModeSwitch] = useState(false)
+ const [
+ showPersistentBranchDeleteConfirmationModal,
+ setShowPersistentBranchDeleteConfirmationModal,
+ ] = useState(false)
const [showEditBranchModal, setShowEditBranchModal] = useState(false)
const { mutate: resetBranch, isLoading: isResetting } = useBranchResetMutation({
@@ -210,6 +215,15 @@ const PreviewBranchActions = ({
updateBranch({ branchRef, projectRef, persistent: !branch.persistent })
}
+ const onDeleteBranch = (e: Event | React.MouseEvent) => {
+ if (isPersistentBranch) {
+ setShowPersistentBranchDeleteConfirmationModal(true)
+ } else {
+ e.stopPropagation()
+ onSelectDeleteBranch()
+ }
+ }
+
return (
<>
@@ -307,14 +321,8 @@ const PreviewBranchActions = ({
{
- e.stopPropagation()
- onSelectDeleteBranch()
- }}
- onClick={(e) => {
- e.stopPropagation()
- onSelectDeleteBranch()
- }}
+ onSelect={onDeleteBranch}
+ onClick={onDeleteBranch}
tooltip={{
content: {
side: 'left',
@@ -373,6 +381,20 @@ const PreviewBranchActions = ({
+ setShowPersistentBranchDeleteConfirmationModal(false)}
+ onConfirm={onTogglePersistent}
+ >
+
+ You must switch the branch "{branch.name}" to preview before deleting it.
+
+
+