From 5fcd59146e0490eca6d89295d12345881ed11da7 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 8 Apr 2024 12:15:34 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10930 --- app/src/layout/dock/Graph.ts | 7 +++++++ 1 file changed, 7 insertions(+) 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"];