perf(*): 创作工作台 - 优化首页按需加载与画布交互并修复历史迁移冲突

This commit is contained in:
ddCat committed 2026-09-05 13:24:10 +08:00
1 parent 165b4443ab
commit 58f01d1eb6
107 files changed
+3025 -1089

No files matched your search

@@ -438,6 +438,12 @@ function rebaseCommittedCanvasGenerationOntoLiveProject(scope: string, projectId
export async function persistCanvasGenerationEffect(input: CanvasGenerationEffectInput) {
throwIfAborted(input.signal);
const scope = getActiveUserScope();
if (!useCanvasStore.getState().projects.some((project) => project.id === input.projectId)) {
const { loadCanvasProjectForEditing } = await import("@/services/user-data-sync");
await loadCanvasProjectForEditing(input.projectId);
throwIfAborted(input.signal);
if (scope !== getActiveUserScope()) throw new Error("账号已切换,无法写入生成结果");
}
const baseRevision = canvasStoreStorageRevision(scope);
const memoryProjects = useCanvasStore.getState().projects;
const memoryProject = memoryProjects.find((candidate) => candidate.id === input.projectId);