From 9cb434c51c73840d03278b987237c50855e58f57 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:21:58 -0400 Subject: [PATCH] Code Quality: Defer CurrentSelectedMode assignment in OmnibarMode_Loaded --- src/Files.App.Controls/Omnibar/OmnibarMode.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Files.App.Controls/Omnibar/OmnibarMode.cs b/src/Files.App.Controls/Omnibar/OmnibarMode.cs index c81216c25a08..9f413b7a5c75 100644 --- a/src/Files.App.Controls/Omnibar/OmnibarMode.cs +++ b/src/Files.App.Controls/Omnibar/OmnibarMode.cs @@ -89,7 +89,12 @@ private void OmnibarMode_Loaded(object sender, RoutedEventArgs e) { // Set this mode as the current mode if it is the default mode if (IsDefault && _ownerRef is not null && _ownerRef.TryGetTarget(out var owner)) - owner.CurrentSelectedMode = this; + { + DispatcherQueue.TryEnqueue(() => + { + owner.CurrentSelectedMode = this; + }); + } } public void SetOwner(Omnibar owner)