Skip to content

Commit 866db0b

Browse files
authored
Fix: redirect for load balancer source (supabase#40757)
fix redirect for load balancer source
1 parent e23175f commit 866db0b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

apps/studio/components/interfaces/Settings/API/ServiceList.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { AlertCircle } from 'lucide-react'
2+
import { parseAsString, useQueryState } from 'nuqs'
3+
import { useEffect } from 'react'
24

35
import { useParams } from 'common'
46
import { ScaffoldSection } from 'components/layouts/Scaffold'
@@ -20,6 +22,8 @@ export const ServiceList = () => {
2022
const { ref: projectRef } = useParams()
2123
const state = useDatabaseSelectorStateSnapshot()
2224

25+
const [querySource, setQuerySource] = useQueryState('source', parseAsString)
26+
2327
const { data: customDomainData } = useCustomDomainsQuery({ projectRef })
2428
const {
2529
data: databases,
@@ -28,6 +32,12 @@ export const ServiceList = () => {
2832
} = useReadReplicasQuery({ projectRef })
2933
const { data: loadBalancers } = useLoadBalancersQuery({ projectRef })
3034

35+
useEffect(() => {
36+
if (querySource && querySource !== state.selectedDatabaseId) {
37+
state.setSelectedDatabaseId(querySource)
38+
}
39+
}, [querySource, state, projectRef])
40+
3141
// Get the API service
3242
const isCustomDomainActive = customDomainData?.customDomain?.status === 'active'
3343
const selectedDatabase = databases?.find((db) => db.identifier === state.selectedDatabaseId)
@@ -61,6 +71,9 @@ export const ServiceList = () => {
6171
? [{ id: 'load-balancer', name: 'API Load Balancer' }]
6272
: []
6373
}
74+
onSelectId={() => {
75+
setQuerySource(null)
76+
}}
6477
/>
6578
</CardHeader>
6679
<CardContent>

apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const LoadBalancerNode = ({ data }: NodeProps<LoadBalancerData>) => {
9696
</DropdownMenuTrigger>
9797
<DropdownMenuContent className="w-40" side="bottom" align="end">
9898
<DropdownMenuItem asChild className="gap-x-2">
99-
<Link href={`/project/${ref}/settings/api?source=loadbalancer`}>View API URL</Link>
99+
<Link href={`/project/${ref}/settings/api?source=load-balancer`}>View API URL</Link>
100100
</DropdownMenuItem>
101101
</DropdownMenuContent>
102102
</DropdownMenu>

0 commit comments

Comments
 (0)