fix: Reduce the frequency of saving empty pages

This commit is contained in:
LIlGG
2025-10-10 11:29:19 +08:00
parent c5d47c680c
commit 3af1c30d49
3 changed files with 24 additions and 2 deletions

View File

@@ -37,6 +37,24 @@ export function useProject() {
logger.error('保存项目失败: 页面或 Section 不能为空');
return false;
}
const isConsistent = projectPages.every((page) => {
const actionIds = page.actionIds;
const content = page.content;
if (actionIds.length === 0) {
return true;
}
if (!content) {
return false;
}
return true;
});
if (!isConsistent) {
logger.error('保存项目失败: 页面内容与 actions 不一致', {
projectPages,
projectSections,
});
return false;
}
try {
// 先保存在本地数据中
saveEditorProject(messageId, projectPages, projectSections);