From 92f5f39f7d29ea5fa9674b29cfa7b40868ca1a49 Mon Sep 17 00:00:00 2001 From: Lisianthus-A Date: Tue, 7 Jan 2025 11:40:06 +0800 Subject: [PATCH] fix: ensure canvas state is saved after loading JSON --- src/layout/Header/Header.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/layout/Header/Header.tsx b/src/layout/Header/Header.tsx index 60dfdf7..7924766 100644 --- a/src/layout/Header/Header.tsx +++ b/src/layout/Header/Header.tsx @@ -223,7 +223,10 @@ function Header() { try { const text = await file.text(); const json = JSON.parse(text); - canvas.loadFromJson(json); + await canvas.loadFromJson(json); + setTimeout(() => { + canvas.saveToStack(); + }); } catch (err) { Toast.show("导入失败"); console.log("catch import error", err);