From cc3d2ce9e4dd8fa125905b8b10bab938af267935 Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Sun, 14 Sep 2025 15:13:42 +0530 Subject: [PATCH] Code Quality: Moved CheckAppUpdate() to run in a separate thread, and invoked the OpenReleaseNotes command using the dispatcher. This improves startup time by running only the essential tasks synchronously. --- .../Helpers/Application/AppLifecycleHelper.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Files.App/Helpers/Application/AppLifecycleHelper.cs b/src/Files.App/Helpers/Application/AppLifecycleHelper.cs index ea722d1e378a..9998ab269836 100644 --- a/src/Files.App/Helpers/Application/AppLifecycleHelper.cs +++ b/src/Files.App/Helpers/Application/AppLifecycleHelper.cs @@ -128,9 +128,11 @@ await Task.WhenAll( FileTagsHelper.UpdateTagsDb(); - // Release notes tab doesn't open unless this is awaited - // Auto update doesn't work unless this is awaited - await CheckAppUpdate(); + _ = Task.Run(async () => + { + // The follwing method invokes UI thread, so we run it in a separate task + await CheckAppUpdate(); + }); static Task OptionalTaskAsync(Task task, bool condition) { @@ -158,8 +160,11 @@ public static async Task CheckAppUpdate() updateService.AreReleaseNotesAvailable && !ViewedReleaseNotes) { - await Ioc.Default.GetRequiredService().OpenReleaseNotes.ExecuteAsync(); - ViewedReleaseNotes = true; + await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () => + { + await Ioc.Default.GetRequiredService().OpenReleaseNotes.ExecuteAsync(); + ViewedReleaseNotes = true; + }); } await updateService.CheckForUpdatesAsync();