Skip to content

Commit ab80b67

Browse files
committed
fix: show table list only if it’s bound with a connection
1 parent 691edcc commit ab80b67

1 file changed

Lines changed: 32 additions & 31 deletions

File tree

‎src/components/ConnectionSidebar.tsx‎

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -164,38 +164,39 @@ const ConnectionSidebar = () => {
164164
/>
165165
</div>
166166
)}
167-
{tableSchemaLoadingState.isLoading ? (
168-
<div className="w-full h-12 flex flex-row justify-start items-center px-4 sticky top-0 border z-1 mb-4 mt-2 rounded-lg text-sm text-gray-600 dark:text-gray-400">
169-
<Icon.BiLoaderAlt className="w-4 h-auto animate-spin mr-1" />{" "}
170-
{t("common.loading")}
171-
</div>
172-
) : (
173-
tableList.length > 0 && (
174-
<div className="w-full sticky top-0 z-1 my-4">
175-
<Select
176-
className="w-full px-4 py-3 !text-base"
177-
value={
178-
conversationStore.getConversationById(
179-
conversationStore.currentConversationId
180-
)?.tableName || ""
181-
}
182-
itemList={tableList.map((table) => {
183-
return {
184-
label:
185-
table.name === ""
186-
? t("connection.all-tables")
187-
: table.name,
188-
value: table.name,
189-
};
190-
})}
191-
onValueChange={(tableName) =>
192-
handleTableNameSelect(tableName)
193-
}
194-
placeholder={t("connection.select-table") || ""}
195-
/>
167+
{currentConnectionCtx &&
168+
(tableSchemaLoadingState.isLoading ? (
169+
<div className="w-full h-12 flex flex-row justify-start items-center px-4 sticky top-0 border z-1 mb-4 mt-2 rounded-lg text-sm text-gray-600 dark:text-gray-400">
170+
<Icon.BiLoaderAlt className="w-4 h-auto animate-spin mr-1" />{" "}
171+
{t("common.loading")}
196172
</div>
197-
)
198-
)}
173+
) : (
174+
tableList.length > 0 && (
175+
<div className="w-full sticky top-0 z-1 my-4">
176+
<Select
177+
className="w-full px-4 py-3 !text-base"
178+
value={
179+
conversationStore.getConversationById(
180+
conversationStore.currentConversationId
181+
)?.tableName || ""
182+
}
183+
itemList={tableList.map((table) => {
184+
return {
185+
label:
186+
table.name === ""
187+
? t("connection.all-tables")
188+
: table.name,
189+
value: table.name,
190+
};
191+
})}
192+
onValueChange={(tableName) =>
193+
handleTableNameSelect(tableName)
194+
}
195+
placeholder={t("connection.select-table") || ""}
196+
/>
197+
</div>
198+
)
199+
))}
199200
<ConversationList />
200201
</div>
201202
<div className="sticky bottom-0 w-full flex flex-col justify-center bg-gray-100 dark:bg-zinc-700 backdrop-blur bg-opacity-60 pb-4 py-2">

0 commit comments

Comments
 (0)