Follow-up from the review of #1471 (databases tab redesign). @kriszyp and @cb1kenobi suggested a friendlier alternative to the current stale-map toast for "Add Record(s)".
File
src/features/instance/databases/components/DatabaseActionModals.tsx
Current behavior
When the tree/overview right-click "Add New Record(s)" fires setWatchedValue('ShowAddTableRecords', { databaseName, tableName }) but the target table isn't in the fast describe_all map — a stale map between an external drop and the next refetch — the hub toasts "Couldn't open … it may have just been removed. Try refreshing." and clears the trigger. AddTableRowModal needs the table's schema (instanceTable), which today comes only from instanceDatabaseMap[db][table].
Proposed enhancement (refetch-then-open)
Instead of dead-ending on a transient miss:
- On an add target missing from the map, first refetch (invalidate/refetch
describe_all, or fetch describe_table for the target directly via getDescribeTableQueryOptions) and show a brief loading state.
- If the table then resolves, open
AddTableRowModal against it.
- Only fall back to the "may have been removed" toast if it's still absent after the refetch (genuinely dropped).
Keep the fast path unchanged: when the table is in the map, open immediately with no extra fetch. Scope the change to the hub (and possibly sourcing instanceTable from a fresh describe_table when the map lacks it). Add a test if practical.
Low priority — reachable only in the brief window between an external drop and the cache refetch. Verify with npx vitest run src/features/instance/databases, npx tsc -b, npx oxlint.
Follow-up from the review of #1471 (databases tab redesign). @kriszyp and @cb1kenobi suggested a friendlier alternative to the current stale-map toast for "Add Record(s)".
File
src/features/instance/databases/components/DatabaseActionModals.tsxCurrent behavior
When the tree/overview right-click "Add New Record(s)" fires
setWatchedValue('ShowAddTableRecords', { databaseName, tableName })but the target table isn't in the fastdescribe_allmap — a stale map between an external drop and the next refetch — the hub toasts "Couldn't open … it may have just been removed. Try refreshing." and clears the trigger.AddTableRowModalneeds the table's schema (instanceTable), which today comes only frominstanceDatabaseMap[db][table].Proposed enhancement (refetch-then-open)
Instead of dead-ending on a transient miss:
describe_all, or fetchdescribe_tablefor the target directly viagetDescribeTableQueryOptions) and show a brief loading state.AddTableRowModalagainst it.Keep the fast path unchanged: when the table is in the map, open immediately with no extra fetch. Scope the change to the hub (and possibly sourcing
instanceTablefrom a freshdescribe_tablewhen the map lacks it). Add a test if practical.Low priority — reachable only in the brief window between an external drop and the cache refetch. Verify with
npx vitest run src/features/instance/databases,npx tsc -b,npx oxlint.