mirror of
https://github.com/supabase/supabase.git
synced 2026-09-09 11:30:17 +08:00
## What kind of change does this PR introduce? Feature. Stack 5 of 5 (tip) for [PIPE-1007](https://linear.app/supabase/issue/PIPE-1007/move-read-replicas-out-of-replication-into-infrastructure). ## What is the current behavior? Selectors still open Replication with `destinationType=Read+Replica`. Compute eligibility actions leave the add-replica flow without carrying a recommended size into the Infrastructure form. ## What is the new behavior? DatabaseSelector and the SQL submenu open Infrastructure `?addReplica=true`. Change to Small/XL compute waits for the sheet to close, pre-selects that size, then focuses and scrolls the Infrastructure form to Compute without shifting the page footer. ## Additional context Last stack PR. [#49043](https://github.com/supabase/supabase/pull/49043) has merged. Please review, but do not merge until 2→4 are also approved. Then merge [#49044](https://github.com/supabase/supabase/pull/49044) → [#49045](https://github.com/supabase/supabase/pull/49045) → [#49046](https://github.com/supabase/supabase/pull/49046) → this PR in succession, and drop the `do-not-merge` labels. Update the read replicas getting-started doc in the same sitting so it points only at Infrastructure (it currently also links Database → Replication). Remaining stack: [#49044](https://github.com/supabase/supabase/pull/49044) → [#49045](https://github.com/supabase/supabase/pull/49045) → [#49046](https://github.com/supabase/supabase/pull/49046) → this PR ## To test `infrastructure:read_replicas` is an enabled-feature, on by default. There is no Feature Preview or ConfigCat switch. You should already see the Infrastructure Read replicas section. If you do not, your profile lists `infrastructure:read_replicas` in `disabled_features`. 1. [Infrastructure](https://studio-staging-git-dnywh-choreread-replicas-in-829a4b-supabase.vercel.app/dashboard/project/_/settings/infrastructure): topology, Read replicas, Scaling. 2. Add read replica. If blocked on compute, Change to Small compute: sheet closes, Small is selected and focused, the price footer is dirty, and no blank page gap appears. 3. From the SQL editor database selector, Add replica should open Infrastructure, not Replication.
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { useParams } from 'common'
|
|
import { Loader2 } from 'lucide-react'
|
|
|
|
import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
|
|
import { PROJECT_STATUS } from '@/lib/constants'
|
|
|
|
export const ResizingState = () => {
|
|
const { ref } = useParams()
|
|
useProjectDetailQuery(
|
|
{ ref },
|
|
{
|
|
// setting a refetch interval here will cause the `useSelectedProject()` in `ProjectLayout.tsx` to
|
|
// rerender every 4 seconds while the project is resizing. Once resizing is complete, it will
|
|
// no longer show this state.
|
|
refetchInterval: (query) => {
|
|
const data = query.state.data
|
|
return data?.status !== PROJECT_STATUS.ACTIVE_HEALTHY ? 4000 : false
|
|
},
|
|
}
|
|
)
|
|
|
|
return (
|
|
<div className="flex items-center justify-center h-full">
|
|
<div className="bg-surface-100 border border-overlay rounded-md w-3/4 lg:w-1/2">
|
|
<div className="space-y-6 py-6">
|
|
<div className="flex px-8 space-x-8">
|
|
<div className="mt-1">
|
|
<Loader2 className="animate-spin text-foreground-light" size={18} />
|
|
</div>
|
|
<div className="flex flex-col gap-1">
|
|
<p>Resizing project</p>
|
|
<p className="text-sm text-foreground-light">
|
|
Your project is being restarted to apply compute size changes. It will remain
|
|
offline until fully restarted. This can take a few minutes.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|