From 33ca4e734b7b1519e95d598d2b35ac25c30abe34 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 2 Aug 2026 19:27:58 +0200 Subject: [PATCH] Stopped the build progress timer from waking the renderer while idle --- .../VisualBriefingBuildProgress.razor.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingBuildProgress.razor.cs b/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingBuildProgress.razor.cs index f3bbcee3..cd8ee808 100644 --- a/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingBuildProgress.razor.cs +++ b/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingBuildProgress.razor.cs @@ -90,14 +90,21 @@ public partial class VisualBriefingBuildProgress : MSGComponentBase try { while (await timer.WaitForNextTickAsync(token)) + { + // This panel stays on screen for as long as the briefing has any build, so most of the + // time there is no running stage and nothing to refresh. The check happens here rather + // than inside the callback below, because otherwise every second would still cost a hop + // onto the renderer just to find that out. Reading the build here is safe: the progress + // service publishes snapshots, so this record is never the one the build mutates. + if (this.Build?.Stages.Any(stage => stage.Status is VisualBriefingBuildStageStatus.RUNNING) != true) + continue; + await this.InvokeAsync(() => { - if (this.Build?.Stages.Any(stage => stage.Status is VisualBriefingBuildStageStatus.RUNNING) != true) - return; - this.durationReferenceUtc = DateTimeOffset.UtcNow; this.StateHasChanged(); }); + } } catch (OperationCanceledException) when (token.IsCancellationRequested) {