From 69e285df2973c545c72ccd9f03faff22355afcf5 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Thu, 22 Aug 2024 18:49:05 -0500 Subject: [PATCH] fix bug due to including parent selector in router fetch --- app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx | 2 +- app/table/cells/RouterLinkCell.tsx | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx b/app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx index ca66dd0313..c24c2eb732 100644 --- a/app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx +++ b/app/pages/project/vpcs/VpcPage/tabs/VpcSubnetsTab.tsx @@ -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) => , + cell: (info) => , }), colHelper.accessor('timeCreated', Columns.timeCreated), getActionsCol(makeActions), diff --git a/app/table/cells/RouterLinkCell.tsx b/app/table/cells/RouterLinkCell.tsx index a56b52eab6..81e19b10ef 100644 --- a/app/table/cells/RouterLinkCell.tsx +++ b/app/table/cells/RouterLinkCell.tsx @@ -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 + if (!routerId) return // probably not possible but let’s be safe if (isError) return Deleted if (!router) return // loading