fix(editor): a superseded export plan or estimate never replaces the current one

Undo and redo bring back the same project instance, so a cancelled planning
request passed the 'still current' check and published an empty plan (Render
disabled) or blank preset estimates. Only requests that ran now publish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-03 11:19:30 +00:00
1 parent 90321a7e53
commit 6e01995f7e
3 files changed
+11 -2

No files matched your search

+4 -1
View File
@@ -412,6 +412,7 @@ public sealed class ExportTab : EditorTab
var project = Editor.Session.Project;
var cards = Cards;
var plans = new ExportPlan?[cards.Count];
var done = false;
try
{
await _estimates.Schedule(token =>
@@ -422,6 +423,7 @@ public sealed class ExportTab : EditorTab
var export = project.Export with { Preset = project.Export.Preset.WithManual(cards[i].Choice.ExportPresetId), Overrides = new ExportOverrides(), Batch = [] };
plans[i] = Editor.Planner.Plan(project, export);
}
done = true;
return Task.CompletedTask;
});
}
@@ -430,7 +432,8 @@ public sealed class ExportTab : EditorTab
Core.Diagnostics.Log.Warning("editor", "Preset estimates failed", ex);
return;
}
if (!ReferenceEquals(cards, Cards) || !ReferenceEquals(project, Editor.Session.Project)) return;
// A superseded request stops part way (or never starts); undo can bring back the same project instance.
if (!done || !ReferenceEquals(cards, Cards) || !ReferenceEquals(project, Editor.Session.Project)) return;
for (var i = 0; i < cards.Count; i++) cards[i].Update(plans[i]);
}