Skip to content

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

Chore/enabling branching fixes (#19324)

Joshen Lim6435c945b2eb
diff --git a/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
index d656851c4fd..018f10b4b38 100644
--- a/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/ComputeInstanceSidePanel.tsx
@@ -73,7 +73,10 @@ const ComputeInstanceSidePanel = () => {
const snap = useSubscriptionPageStateSnapshot()
const visible = snap.panelKey === 'computeInstance'
- const onClose = () => snap.setPanelKey(undefined)
+ const onClose = () => {
+ router.push(router.asPath.split('?')[0], undefined, { shallow: true })
+ snap.setPanelKey(undefined)
+ }
const { data: addons, isLoading } = useProjectAddonsQuery({ projectRef })
const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: organization?.slug })
diff --git a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
index b79c34369dc..c8d21972c91 100644
--- a/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/CustomDomainSidePanel.tsx
@@ -38,7 +38,10 @@ const CustomDomainSidePanel = () => {
const snap = useSubscriptionPageStateSnapshot()
const visible = snap.panelKey === 'customDomain'
- const onClose = () => snap.setPanelKey(undefined)
+ const onClose = () => {
+ router.push(router.asPath.split('?')[0], undefined, { shallow: true })
+ snap.setPanelKey(undefined)
+ }
const { data: addons, isLoading } = useProjectAddonsQuery({ projectRef })
const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: organization?.slug })
diff --git a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
index 3ef264a1acd..b5b285691df 100644
--- a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx
@@ -64,7 +64,10 @@ const PITRSidePanel = () => {
const snap = useSubscriptionPageStateSnapshot()
const visible = snap.panelKey === 'pitr'
- const onClose = () => snap.setPanelKey(undefined)
+ const onClose = () => {
+ router.push(router.asPath.split('?')[0], undefined, { shallow: true })
+ snap.setPanelKey(undefined)
+ }
const { data: addons, isLoading } = useProjectAddonsQuery({ projectRef })
const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: organization?.slug })
diff --git a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
index 20ae5755232..048babf74f9 100644
--- a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
@@ -132,7 +132,7 @@ const SSLConfiguration = () => {
<IconLoader className="animate-spin" strokeWidth={1.5} size={16} />
)}
<Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger asChild>
+ <Tooltip.Trigger>
<Toggle
checked={isEnforced}
disabled={
diff --git a/apps/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx b/apps/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx
index 30e15d01af8..45c0078ffa0 100644
--- a/apps/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx
+++ b/apps/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx
@@ -133,7 +133,7 @@ const EnableBranchingModal = () => {
visible={snap.showEnableBranchingModal}
onCancel={() => snap.setShowEnableBranchingModal(false)}
className="!bg"
- size="medium"
+ size="large"
>
<Form_Shadcn_ {...form}>
<form
@@ -169,130 +169,111 @@ const EnableBranchingModal = () => {
</>
)}
- {hasPitrEnabled ? (
+ {isErrorIntegrations && (
<>
- {isErrorIntegrations && (
- <>
- <Modal.Separator />
- <Modal.Content className="px-7 py-6">
- <AlertError
- error={integrationsError}
- subject="Failed to retrieve integrations"
- />
- </Modal.Content>
- <Modal.Separator />
- </>
- )}
+ <Modal.Separator />
+ <Modal.Content className="px-7 py-6">
+ <AlertError error={integrationsError} subject="Failed to retrieve integrations" />
+ </Modal.Content>
+ <Modal.Separator />
+ </>
+ )}
- {isSuccessIntegrations && (
- <GithubRepositorySelection
- form={form}
- isChecking={isChecking}
- isValid={canSubmit}
- integration={githubIntegration}
- hasGithubIntegrationInstalled={hasGithubIntegrationInstalled}
- />
+ {isSuccessIntegrations && (
+ <GithubRepositorySelection
+ form={form}
+ isChecking={isChecking}
+ isValid={canSubmit}
+ integration={githubIntegration}
+ hasGithubIntegrationInstalled={hasGithubIntegrationInstalled}
+ />
+ )}
+
+ {!hasPitrEnabled && (
+ <Alert_Shadcn_ className="rounded-none px-7 py-6 [&>svg]:top-6 [&>svg]:left-6 !border-t-0 !border-l-0 !border-r-0">
+ {/* <AlertCircleIcon strokeWidth={2} /> */}
+ <AlertTitle_Shadcn_ className="text-base">
+ We strongly encourage enabling Point in Time Recovery (PITR)
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ This is to ensure that you can always recover data if you make a "bad migration".
+ For example, if you accidentally delete a column or some of your production data.
+ </AlertDescription_Shadcn_>
+ {isFreePlan && (
+ <AlertDescription_Shadcn_ className="mt-2">
+ To enable PITR, you may first upgrade your organization's plan to at least Pro,
+ then purchase the PITR add on for your project via the{' '}
+ <Link
+ href={`/project/${ref}/settings/addons?panel=pitr`}
+ className="text-brand"
+ onClick={() => snap.setShowEnableBranchingModal(false)}
+ >
+ project settings
+ </Link>
+ .
+ </AlertDescription_Shadcn_>
)}
+ <Button size="tiny" type="default" className="mt-4">
+ <Link
+ href={
+ isFreePlan
+ ? `/org/${selectedOrg?.slug}/billing?panel=subscriptionPlan`
+ : `/project/${ref}/settings/addons?panel=pitr`
+ }
+ onClick={() => snap.setShowEnableBranchingModal(false)}
+ >
+ {isFreePlan ? 'Upgrade to Pro' : 'Enable PITR add-on'}
+ </Link>
+ </Button>
+ </Alert_Shadcn_>
+ )}
- <Modal.Content className="px-7 py-6 flex flex-col gap-3">
+ <Modal.Content className="px-7 py-6 flex flex-col gap-3">
+ <p className="text-sm text-foreground-light">Please keep in mind the following:</p>
+ <div className="flex flex-row gap-4">
+ <div>
+ <figure className="w-10 h-10 rounded-md bg-warning-200 border border-warning-300 flex items-center justify-center">
+ <IconFileText className="text-amber-900" size={20} strokeWidth={2} />
+ </figure>
+ </div>
+ <div className="flex flex-col gap-y-1">
+ <p className="text-sm text-foreground">
+ You will not be able to make changes to the database via the dashboard
+ </p>
<p className="text-sm text-foreground-light">
- Please keep in mind the following:
+ Schema changes for database Preview Branches must be made using Git. Dashboard
+ changes to Preview Branches are coming soon.
</p>
- <div className="flex flex-row gap-4">
- <div>
- <figure className="w-10 h-10 rounded-md bg-warning-200 border border-warning-300 flex items-center justify-center">
- <IconFileText className="text-amber-900" size={20} strokeWidth={2} />
- </figure>
- </div>
- <div>
- <p className="text-sm text-foreground">
- You will not be able to use the dashboard to make changes to the database
- </p>
- <p className="text-sm text-foreground-light">
- Schema changes for database Preview Branches must be made using git.
- Dashboard changes to Preview Branches are coming soon.
- </p>
- </div>
- </div>
- </Modal.Content>
+ </div>
+ </div>
+ </Modal.Content>
- <Modal.Separator />
+ <Modal.Separator />
- <Modal.Content className="px-7">
- <div className="flex items-center space-x-2 py-2 pb-4">
- <Button
- size="medium"
- block
- disabled={isCreating}
- type="default"
- onClick={() => snap.setShowEnableBranchingModal(false)}
- >
- Cancel
- </Button>
- <Button
- block
- size="medium"
- form={formId}
- disabled={isCreating || !canSubmit}
- loading={isCreating}
- type="primary"
- htmlType="submit"
- >
- I understand, enable branching
- </Button>
- </div>
- </Modal.Content>
- </>
- ) : (
- <div className="">
- <Alert_Shadcn_ className="rounded-none border-r-0 border-l-0 px-7 [&>svg]:left-6">
- <AlertCircleIcon strokeWidth={2} />
- <AlertTitle_Shadcn_>
- Point in time recovery (PITR) is required for branching
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- This is to ensure that you can always recover data if you make a "bad
- migration". For example, if you accidentally delete a column or some of your
- production data.
- </AlertDescription_Shadcn_>
- {isFreePlan && (
- <AlertDescription_Shadcn_ className="mt-2">
- To enable PITR, you may first upgrade your organization's plan to at least
- Pro, then purchase the PITR add on for your project via the{' '}
- <Link
- href={`/project/${ref}/settings/addons?panel=pitr`}
- className="text-brand"
- >
- project settings
- </Link>
- .
- </AlertDescription_Shadcn_>
- )}
- </Alert_Shadcn_>
- <Modal.Content className="px-7">
- <div className="flex items-center justify-end space-x-2 py-4 pb-4">
- <Button
- size="tiny"
- type="default"
- onClick={() => snap.setShowEnableBranchingModal(false)}
- >
- Understood
- </Button>
- <Button size="tiny">
- <Link
- href={
- isFreePlan
- ? `/org/${selectedOrg?.slug}/billing?panel=subscriptionPlan`
- : `/project/${ref}/settings/addons?panel=pitr`
- }
- >
- {isFreePlan ? 'Upgrade to Pro' : 'Enable PITR'}
- </Link>
- </Button>
- </div>
- </Modal.Content>
+ <Modal.Content className="px-7">
+ <div className="flex items-center space-x-2 py-2 pb-4">
+ <Button
+ size="medium"
+ block
+ disabled={isCreating}
+ type="default"
+ onClick={() => snap.setShowEnableBranchingModal(false)}
+ >
+ Cancel
+ </Button>
+ <Button
+ block
+ size="medium"
+ form={formId}
+ disabled={isCreating || !canSubmit}
+ loading={isCreating}
+ type="primary"
+ htmlType="submit"
+ >
+ I understand, enable branching
+ </Button>
</div>
- )}
+ </Modal.Content>
</form>
</Form_Shadcn_>
</Modal>