diff --git a/apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx b/apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx index a4ffed86e90..7f685eb6989 100644 --- a/apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx +++ b/apps/studio/pages/project/[ref]/database/backups/restore-to-new-project.tsx @@ -82,7 +82,7 @@ const RestoreToNewProject = () => { PermissionAction.INFRA_EXECUTE, 'queue_job.restore.prepare' ) - const hasPITREnabled = cloneBackups?.pitr_enabled + const PITR_ENABLED = cloneBackups?.pitr_enabled const dbVersion = getDatabaseMajorVersion(project?.dbVersion ?? '') const IS_PG15_OR_ABOVE = dbVersion >= 15 @@ -100,9 +100,10 @@ const RestoreToNewProject = () => { refetchInterval, refetchOnWindowFocus: false, onSuccess: (data) => { - const hasTransientState = data.clones.some((c) => c.status === 'IN_PROGRESS') + const hasTransientState = data?.clones.some((c) => c.status === 'IN_PROGRESS') if (!hasTransientState) setRefetchInterval(false) }, + enabled: PHYSICAL_BACKUPS_ENABLED || PITR_ENABLED, } ) const IS_CLONED_PROJECT = (cloneStatus?.cloned_from?.source_project as any)?.ref ? true : false @@ -179,6 +180,16 @@ const RestoreToNewProject = () => { } } + if (isFreePlan) { + return ( + + ) + } + if (isOrioleDb) { return ( { ) } - if (isLoading) { - return - } - if (!canReadPhysicalBackups) { return } @@ -243,14 +250,8 @@ const RestoreToNewProject = () => { ) } - if (plan === 'free') { - return ( - - ) + if (isLoading) { + return } if (IS_CLONED_PROJECT) { @@ -286,7 +287,7 @@ const RestoreToNewProject = () => { if ( !isLoading && - hasPITREnabled && + PITR_ENABLED && !cloneBackups?.physicalBackupData.earliestPhysicalBackupDateUnix ) { return ( @@ -298,7 +299,7 @@ const RestoreToNewProject = () => { ) } - if (!isLoading && !hasPITREnabled && cloneBackups?.backups.length === 0) { + if (!isLoading && !PITR_ENABLED && cloneBackups?.backups.length === 0) { return ( <> { ) : null} - {hasPITREnabled ? ( + {PITR_ENABLED ? ( <>