From 984b7d8f489524f8c626c9a98e8b92a1e15cd6d1 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sun, 29 Nov 2026 07:02:33 +0700 Subject: [PATCH] fix(windows): choosing a sync provider through UI Automation no longer fails while the choice runs --- windows/src/TablePro.App/Views/SettingsView.Sync.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/windows/src/TablePro.App/Views/SettingsView.Sync.cs b/windows/src/TablePro.App/Views/SettingsView.Sync.cs index bbf993117c..f65263102d 100644 --- a/windows/src/TablePro.App/Views/SettingsView.Sync.cs +++ b/windows/src/TablePro.App/Views/SettingsView.Sync.cs @@ -243,8 +243,8 @@ private void ShowSyncBar(string title, string message, InfoBarSeverity severity, SyncBar.IsOpen = true; } - // The stored provider changes only once the core side of the choice returned, so the box goes back to it after. - private async void OnSyncProviderChanged(object sender, SelectionChangedEventArgs e) + // Disabling the box inside its own SelectionChanged fails the UI Automation Select that chose it, so it runs after. + private void OnSyncProviderChanged(object sender, SelectionChangedEventArgs e) { if (_loading || SyncProviderBox.SelectedItem is not ComboBoxItem { Tag: string tag }) { @@ -257,7 +257,13 @@ private async void OnSyncProviderChanged(object sender, SelectionChangedEventArg return; } - _syncChoosing = true; + _syncChoosing = DispatcherQueue.TryEnqueue( + async () => await ChooseSyncProviderAsync(chosen).ConfigureAwait(true)); + } + + // The stored provider changes only once the core side of the choice returned, so the box goes back to it after. + private async Task ChooseSyncProviderAsync(SyncProvider chosen) + { ShowSync(); try {