diff --git a/app/src/layout/dock/Graph.ts b/app/src/layout/dock/Graph.ts index f1d92c823..4cfd3dcb9 100644 --- a/app/src/layout/dock/Graph.ts +++ b/app/src/layout/dock/Graph.ts @@ -551,6 +551,13 @@ export class Graph extends Model { clearTimeout(this.timeout); addScript(`${Constants.PROTYLE_CDN}/js/vis/vis-network.min.js?v=9.1.2`, "protyleVisScript").then(() => { this.timeout = window.setTimeout(() => { + if (!this.graphData || !this.graphData.nodes || this.graphData.nodes.length === 0) { + if (this.network) { + this.network.destroy(); + } + this.graphElement.firstElementChild.classList.add("fn__none"); + return; + } this.graphElement.firstElementChild.classList.remove("fn__none"); this.graphElement.firstElementChild.firstElementChild.setAttribute("style", "width:3%"); const config = window.siyuan.config.graph[this.type === "global" ? "global" : "local"];