MCPcopy Index your code
hub / github.com/sqlchat/sqlchat / handleDatabaseNameSelect

Function handleDatabaseNameSelect

src/components/ConnectionSidebar.tsx:149–166  ·  view source on GitHub ↗
(databaseName: string)

Source from the content-addressed store, hash-verified

147 };
148
149 const handleDatabaseNameSelect = async (databaseName: string) => {
150 if (!currentConnectionCtx?.connection) {
151 return;
152 }
153
154 const databaseList = await connectionStore.getOrFetchDatabaseList(currentConnectionCtx.connection);
155 const database = databaseList.find((database) => database.name === databaseName);
156 connectionStore.setCurrentConnectionCtx({
157 connection: currentConnectionCtx.connection,
158 database: database,
159 });
160 if (database) {
161 tableSchemaLoadingState.setLoading();
162 connectionStore.getOrFetchDatabaseSchema(database).then(() => {
163 tableSchemaLoadingState.setFinish();
164 });
165 }
166 };
167
168 // only create conversation when currentConversation is null.
169 // Note: This function is used to solve issue #95

Callers 1

ConnectionSidebarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected