MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / toggleDatabase

Function toggleDatabase

frontend/src/components/tabs/query/SchemaBrowser.tsx:367–387  ·  view source on GitHub ↗
(dbId: string)

Source from the content-addressed store, hash-verified

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

Callers 1

SchemaBrowserFunction · 0.85

Calls 4

handleMotherDuckRefreshFunction · 0.85
hasMethod · 0.80
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected