fix(sidebar): show loading while global search is in flight
This commit is contained in:
1 parent
bdf5f6a87c
commit
c573c249ed
6 files changed
+123
-8
No files matched your search
@@ -518,8 +518,16 @@ describe("connectionStore metadata loading", () => {
|
||||
store.treeNodes = [node];
|
||||
|
||||
const normalLoad = store.loadDatabases(connection.id);
|
||||
const searchLoad = store.loadConnectedConnectionRootForSidebarSearch(connection.id);
|
||||
await listStarted;
|
||||
const searchLoad = store.loadConnectedConnectionRootForSidebarSearch(connection.id);
|
||||
let searchLoadSettled = false;
|
||||
void searchLoad.finally(() => {
|
||||
searchLoadSettled = true;
|
||||
});
|
||||
await Promise.resolve();
|
||||
|
||||
expect(searchLoadSettled).toBe(false);
|
||||
|
||||
resolveDatabases([{ name: "dajia", comment: null }]);
|
||||
await Promise.all([normalLoad, searchLoad]);
|
||||
|
||||
|
||||
@@ -3755,9 +3755,14 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
const config = getConfig(connectionId);
|
||||
if (!config || ["redis", "etcd", "zookeeper", "consul", "mongodb", "elasticsearch", "easysearch", "meilisearch", "milvus", "qdrant", "weaviate", "chromadb", "mq", "nacos"].includes(config.db_type)) return;
|
||||
const node = findConnectionNode(connectionId);
|
||||
if (!node || node.type !== "connection" || node.isLoading || hasConnectionMetadataChildren(node.children)) return;
|
||||
if (!node || node.type !== "connection" || hasConnectionMetadataChildren(node.children)) return;
|
||||
const scope = { kind: "connection-databases" as const, connectionId, driverProfile: metadataDriverProfile(config) };
|
||||
if (metadataLoadCoordinator.has(scope)) return;
|
||||
const inFlight = metadataLoadCoordinator.inFlightPromise<void>(scope);
|
||||
if (inFlight) {
|
||||
await inFlight;
|
||||
return;
|
||||
}
|
||||
if (node.isLoading) return;
|
||||
|
||||
const wasExpanded = !!node.isExpanded;
|
||||
const load = beginTreeNodeLoad(node);
|
||||
|
||||
Reference in new issue
Block a user