reset variable after build

This commit is contained in:
codetypes committed 2025-04-14 09:45:30 +08:00
1 parent b2acee3b6e
commit 4d8a4a0430
1 file changed
+8 -2
+8 -2
View File
@@ -10,7 +10,7 @@ import { message } from "../misc/hooks";
import i18n from "../misc/i18n";
import Path from "../misc/path";
import { zhNodeDef } from "../misc/template";
import { readJson, readTree, readWorkspace, writeJson } from "../misc/util";
import { readJson, readTree, readWorkspace, writeJson, writeTree } from "../misc/util";
import { useSetting } from "./setting-context";
let buildDir: string | undefined;
@@ -377,6 +377,9 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
console.error(error);
message.error(i18n.t("buildFailed"));
}
if (workspace.editing) {
workspace.refresh(workspace.editing.path);
}
console.debug = debug;
}
},
@@ -404,7 +407,7 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
tree = b3util.processBatch(tree, file.path, batch);
if (tree) {
batch.onWriteFile?.(file.path, tree);
fs.writeFileSync(file.path, JSON.stringify(tree, null, 2));
writeTree(file.path, tree);
}
});
batch.onComplete?.("success");
@@ -412,6 +415,9 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
hasError = true;
console.error(error);
}
if (workspace.editing) {
workspace.refresh(workspace.editing.path);
}
if (hasError) {
message.error(i18n.t("batchFailed"));
} else {