chore: add debug logging for version history debounce
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user