Compare commits

..

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
466bd0c0a5 Fix: subscribe to ItemsChanged before fetching items to avoid missing early events
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/3f380bd3-a56a-4708-80ef-3e7d534c4f6f

Co-authored-by: MuyuanMS <116717757+MuyuanMS@users.noreply.github.com>
2026-04-29 08:58:21 +00:00
copilot-swe-agent[bot]
8db30b7e46 Initial plan 2026-04-29 08:49:46 +00:00
5 changed files with 5 additions and 15 deletions

View File

@@ -129,8 +129,8 @@ public partial class ContentPageViewModel : PageViewModel, ICommandBarContext
UpdateDetails();
FetchContent();
model.ItemsChanged += Model_ItemsChanged;
FetchContent();
DoOnUiThread(
() =>

View File

@@ -44,9 +44,9 @@ public partial class ContentTreeViewModel(ITreeContent _tree, WeakReference<IPag
UpdateProperty(nameof(Root));
}
FetchContent();
model.PropChanged += Model_PropChanged;
model.ItemsChanged += Model_ItemsChanged;
FetchContent();
}
// Theoretically, we should unify this with the one in CommandPalettePageViewModelFactory

View File

@@ -209,8 +209,8 @@ public sealed partial class DockBandViewModel : ExtensionObjectViewModel
var list = command.Model.Unsafe as IListPage;
if (list is not null)
{
InitializeFromList(list);
list.ItemsChanged += HandleItemsChanged;
InitializeFromList(list);
}
else
{

View File

@@ -957,8 +957,8 @@ public partial class ListViewModel : PageViewModel, IDisposable
Filters?.InitializeProperties();
UpdateProperty(nameof(Filters));
FetchItems(true);
model.ItemsChanged += Model_ItemsChanged;
FetchItems(true);
}
private static IGridPropertiesViewModel? LoadGridPropertiesViewModel(IGridProperties? gridProperties)

View File

@@ -133,17 +133,7 @@ public sealed partial class MainWindow : WindowEx,
_keyboardListener = new KeyboardListener();
_keyboardListener.Start();
// Dispatch HandleSummon to the UI thread. When UseLowLevelGlobalHotkey is enabled,
// this ProcessCommand callback is invoked directly from the WH_KEYBOARD_LL low-level
// keyboard hook callback, which is an input-synchronous context. Calling window/WinUI
// operations (e.g. ShowWindow, Hide) from that context triggers outgoing COM calls that
// COM forbids inside input-sync calls, causing RPC_E_CANTCALLOUT_ININPUTSYNCCALL (0x8001010D).
// TryEnqueue posts the work to the UI thread's message queue so it runs after the hook
// callback returns, outside the input-sync restriction.
// Note: the standard WM_HOTKEY path (HotKeyPrc) already runs on the UI thread's message
// pump and does not require this dispatch.
_keyboardListener.SetProcessCommand(new CmdPalKeyboardService.ProcessCommand(
(id) => DispatcherQueue.TryEnqueue(() => HandleSummon(id))));
_keyboardListener.SetProcessCommand(new CmdPalKeyboardService.ProcessCommand(HandleSummon));
WM_TASKBAR_RESTART = PInvoke.RegisterWindowMessage("TaskbarCreated");