diff --git a/ui/src/routes/tables.tsx b/ui/src/routes/tables.tsx index a1a5e37..6483410 100644 --- a/ui/src/routes/tables.tsx +++ b/ui/src/routes/tables.tsx @@ -47,27 +47,44 @@ function Tables() { ); - const tab = table - ? data.tables.findIndex(({ name }) => name === table).toString() - : "0"; + const requestedTableIndex = table + ? data.tables.findIndex(({ name }) => name === table) + : -1; + + const requestedTableMissing = !!table && requestedTableIndex < 0; + const tab = String(Math.max(requestedTableIndex, 0)); return ( - - - {data.tables.map((n, i) => ( - - - {n.name} [{n.count.toLocaleString()}] - - + <> + {requestedTableMissing && ( + + + Table not found + + Could not find "{table}". Showing the first available table + instead. + + + + )} + + + + {data.tables.map((n, i) => ( + + + {n.name} [{n.count.toLocaleString()}] + + + ))} + + {data.tables.map(({ name }, i) => ( + + + ))} - - {data.tables.map(({ name }, i) => ( - -
- - ))} - + + ); }