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:
3 files changed
+11
-2
No files matched your search
@@ -577,19 +577,24 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
private async Task RunPlanAsync(ExportPlanner planner, ProjectSettings project)
|
||||
{
|
||||
ExportPlan? plan = null;
|
||||
// A superseded request ends quietly without planning; undo and redo bring back the very same project instance,
|
||||
// so only a request that ran may publish (a failed plan publishes null: "nothing to render").
|
||||
var ran = false;
|
||||
try
|
||||
{
|
||||
await _plans.Schedule(_ =>
|
||||
{
|
||||
plan = planner.Plan(project);
|
||||
ran = true;
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException or InvalidOperationException or RenderException)
|
||||
{
|
||||
Log.Warning("editor", "Planning the export failed", ex);
|
||||
ran = true;
|
||||
}
|
||||
if (_disposed || !ReferenceEquals(planner, Planner) || !ReferenceEquals(project, Session.Project)) return;
|
||||
if (!ran || _disposed || !ReferenceEquals(planner, Planner) || !ReferenceEquals(project, Session.Project)) return;
|
||||
_planned = true;
|
||||
Plan = plan;
|
||||
OnPropertyChanged(nameof(RenderText));
|
||||
|
||||
Reference in new issue
Block a user