fix(project): race-safe batch scene preview import and close

Serialize updateProject and preview finalize, drain before pack/close, buffer zip entries, and abort finalize cleanly when leaving the project to avoid ENOENT on multi-image drops.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-08-04 09:44:45 +08:00
parent f75444a5dd
commit 4e6f7321b8
5 changed files with 210 additions and 59 deletions
+7 -6
View File
@@ -954,13 +954,14 @@ async function main() {
const finalized = await projectStore.finalizeScenePreviewImport(sceneId, result.assetId);
if (finalized.changed) {
emitSessionState();
emitScenePreviewImportProgress({
sceneId,
assetId: result.assetId,
phase: 'done',
project: finalized.project,
});
}
// Always clear optimizing UI — including abort on project close (changed: false).
emitScenePreviewImportProgress({
sceneId,
assetId: result.assetId,
phase: 'done',
...(finalized.changed && finalized.project ? { project: finalized.project } : {}),
});
} catch (e) {
emitScenePreviewImportProgress({
sceneId,