From b8a5d55e8c416c46e564a1035b8960d838f62f61 Mon Sep 17 00:00:00 2001 From: cocos02 Date: Tue, 16 Jun 2026 17:49:31 +0800 Subject: [PATCH] chore: add debug logging for version history debounce --- editor/stores/editorStore.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/stores/editorStore.ts b/editor/stores/editorStore.ts index 8f49277..4429808 100644 --- a/editor/stores/editorStore.ts +++ b/editor/stores/editorStore.ts @@ -166,9 +166,14 @@ export const useEditorStore = defineStore('editor', () => { function debouncedSaveVersion() { const current = JSON.stringify(gameData.value) - if (current === lastSavedContent) return - if (saveVersionTimer) clearTimeout(saveVersionTimer) + if (current === lastSavedContent) { + console.log('[版本] 内容相同,跳过') + return + } + if (saveVersionTimer) { console.log('[版本] 重置 3s 计时器'); clearTimeout(saveVersionTimer) } + else console.log('[版本] 启动 3s 计时器') saveVersionTimer = setTimeout(async () => { + console.log('[版本] 保存到 IndexedDB') lastSavedContent = current await saveVersion('手动编辑') }, 3000)