Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

only trigger request to /clone in create branch modal when modal is o… (#38454)

Joshen Lim8f3a8f02dd44
diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
index b69109218a9..f85465f7c16 100644
--- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
@@ -89,7 +89,13 @@ export const CreateBranchModal = () => {
useCheckGithubBranchValidity({
onError: () => {},
})
- const { data: cloneBackups, error: cloneBackupsError } = useCloneBackupsQuery({ projectRef })
+ const { data: cloneBackups, error: cloneBackupsError } = useCloneBackupsQuery(
+ { projectRef },
+ {
+ // [Joshen] Only trigger this request when the modal is opened
+ enabled: showCreateBranchModal,
+ }
+ )
const targetVolumeSizeGb = cloneBackups?.target_volume_size_gb ?? 0
const noPhysicalBackups = cloneBackupsError?.message.startsWith(
'Physical backups need to be enabled'