Skip to content

Commit 9ff6ac6

Browse files
authored
Fix bug due to including parent selector in router fetch (#2394)
fix bug due to including parent selector in router fetch
1 parent 8028f9a commit 9ff6ac6

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function VpcSubnetsTab() {
8484
colHelper.accessor('customRouterId', {
8585
header: 'Custom Router',
8686
// RouterLinkCell needed, as we need to convert the customRouterId to the custom router's name
87-
cell: (info) => <RouterLinkCell value={info.getValue()} />,
87+
cell: (info) => <RouterLinkCell routerId={info.getValue()} />,
8888
}),
8989
colHelper.accessor('timeCreated', Columns.timeCreated),
9090
getActionsCol(makeActions),

app/table/cells/RouterLinkCell.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ import { pb } from '~/util/path-builder'
1414
import { EmptyCell, SkeletonCell } from './EmptyCell'
1515
import { LinkCell } from './LinkCell'
1616

17-
export const RouterLinkCell = ({ value }: { value?: string }) => {
17+
export const RouterLinkCell = ({ routerId }: { routerId?: string }) => {
1818
const { project, vpc } = useVpcSelector()
1919
const { data: router, isError } = useApiQuery(
2020
'vpcRouterView',
21-
{
22-
path: { router: value! },
23-
query: { project, vpc },
24-
},
25-
{ enabled: !!value }
21+
{ path: { router: routerId! } }, // it's an ID, so no parent selector
22+
{ enabled: !!routerId }
2623
)
27-
if (!value) return <EmptyCell />
24+
if (!routerId) return <EmptyCell />
2825
// probably not possible but let’s be safe
2926
if (isError) return <Badge color="neutral">Deleted</Badge>
3027
if (!router) return <SkeletonCell /> // loading

0 commit comments

Comments
 (0)