From a3781e26a09702b97e4e211a8bf5f9fbaeeee1dd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 11:51:11 +0000 Subject: [PATCH] fix(editor): read the proxy cache off the UI thread; the Sync gate is known before the job list Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.App/Editor/EditorViewModel.cs | 6 ++++-- src/Titano.App/Sections/SequenceViewModel.cs | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Titano.App/Editor/EditorViewModel.cs b/src/Titano.App/Editor/EditorViewModel.cs index e6dd82b8..0c2439c7 100644 --- a/src/Titano.App/Editor/EditorViewModel.cs +++ b/src/Titano.App/Editor/EditorViewModel.cs @@ -69,7 +69,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable private IThumbnailSource _thumbnails; private int _playLimit; private double? _analysisSecondsPerFrame; - private ExportSyncGate _syncGate = ExportSyncGate.SignedOut; + private ExportSyncGate _syncGate; private bool _disposed; public EditorViewModel(ShellViewModel shell, EditorSession session, IReadOnlyList encoders, EncoderHost host) @@ -103,6 +103,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable Tabs = [Frames, Exposure, new MotionTab(this), new CameraTab(this), new TimeTab(this), new StackTab(this), new ExportTab(this)]; _selectedTab = Exposure; _currentIndex = session.Project.HeroFrame is { } hero && (uint)hero < (uint)FrameCount ? hero : 0; + // Until the link is read (AttachJobsAsync), a sequence of this PC cannot send its renders. + _syncGate = session.IsRemote ? ExportSyncGate.Remote : ExportSyncGate.SignedOut; RenderChoices = [.. ExportPresets.BuiltIn.Select(p => new Choice(p.Id, p.NameKey))]; session.ProjectChanged += OnProjectChanged; @@ -484,11 +486,11 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable /// public async Task AttachJobsAsync() { + await RefreshSyncGateAsync(); var jobs = await Session.Source.ListJobsAsync(CancellationToken.None); foreach (var job in jobs) Track(job); foreach (var job in jobs.OrderBy(j => j.Finished)) LearnAnalysisSpeed(job); OnBusyChanged(); - await RefreshSyncGateAsync(); } /// Reads again whether this sequence can send its renders to the signed-in server (session, link, rights). diff --git a/src/Titano.App/Sections/SequenceViewModel.cs b/src/Titano.App/Sections/SequenceViewModel.cs index 1e2c9fed..6cc2cf5b 100644 --- a/src/Titano.App/Sections/SequenceViewModel.cs +++ b/src/Titano.App/Sections/SequenceViewModel.cs @@ -131,7 +131,9 @@ public sealed class SequenceViewModel : SectionViewModel return local; } var sync = services.Sync; - if (sync.Server is not { } server || sync.Service?.OpenRemote(server, sequenceId) is not { } remote) throw new InvalidOperationException(Loc.L("Editor.Error.Missing")); + // The proxy cache's index and files are read off the UI thread. + if (sync.Server is not { } server || sync.Service is not { } service || await Task.Run(() => service.OpenRemote(server, sequenceId)) is not { } remote) + throw new InvalidOperationException(Loc.L("Editor.Error.Missing")); // An editor whose saves the server refuses would only lose edits. if (!sync.Policy.CanEdit) throw new InvalidOperationException(Loc.L("Editor.Error.RemoteReadOnly")); var api = sync.ConnectEditor() ?? throw new InvalidOperationException(Loc.L("Editor.Error.Missing"));