Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function VpcSubnetsTab() {
colHelper.accessor('customRouterId', {
header: 'Custom Router',
// RouterLinkCell needed, as we need to convert the customRouterId to the custom router's name
cell: (info) => <RouterLinkCell value={info.getValue()} />,
cell: (info) => <RouterLinkCell routerId={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
getActionsCol(makeActions),
Expand Down
11 changes: 4 additions & 7 deletions app/table/cells/RouterLinkCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ import { pb } from '~/util/path-builder'
import { EmptyCell, SkeletonCell } from './EmptyCell'
import { LinkCell } from './LinkCell'

export const RouterLinkCell = ({ value }: { value?: string }) => {
export const RouterLinkCell = ({ routerId }: { routerId?: string }) => {
const { project, vpc } = useVpcSelector()
const { data: router, isError } = useApiQuery(
'vpcRouterView',
{
path: { router: value! },
query: { project, vpc },
},
{ enabled: !!value }
{ path: { router: routerId! } }, // it's an ID, so no parent selector
{ enabled: !!routerId }
)
if (!value) return <EmptyCell />
if (!routerId) return <EmptyCell />
// probably not possible but let’s be safe
if (isError) return <Badge color="neutral">Deleted</Badge>
if (!router) return <SkeletonCell /> // loading
Expand Down