(dbId: string)
| 365 | }; |
| 366 | |
| 367 | const toggleDatabase = async (dbId: string) => { |
| 368 | const isExpanding = !expandedDatabases.has(dbId); |
| 369 | |
| 370 | // If expanding a MotherDuck database and schemas not loaded, auto-refresh |
| 371 | if (isExpanding && dbId !== 'local' && motherDuckConnected) { |
| 372 | const schemas = motherDuckSchemas.get(dbId); |
| 373 | if (!schemas || schemas.length === 0) { |
| 374 | await handleMotherDuckRefresh(dbId); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | setExpandedDatabases(prev => { |
| 379 | const next = new Set(prev); |
| 380 | if (next.has(dbId)) { |
| 381 | next.delete(dbId); |
| 382 | } else { |
| 383 | next.add(dbId); |
| 384 | } |
| 385 | return next; |
| 386 | }); |
| 387 | }; |
| 388 | |
| 389 | const toggleTable = async (tableId: string) => { |
| 390 | // If it's a MotherDuck table and we're expanding it, fetch columns |
no test coverage detected