| 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 |