From 2adfee6f49024f4fee86b08905cffeb17a2a5fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Koral?= <45078678+oguzhankoral@users.noreply.github.com> Date: Fri, 27 Jun 2025 21:14:23 +0300 Subject: [PATCH] Reset menu list on closed according to search text (#956) --- .../Operations/Wizard/SearchToolStripMenuItem.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Components/Operations/Wizard/SearchToolStripMenuItem.cs b/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Components/Operations/Wizard/SearchToolStripMenuItem.cs index f3df40012..ff3e26afd 100644 --- a/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Components/Operations/Wizard/SearchToolStripMenuItem.cs +++ b/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Components/Operations/Wizard/SearchToolStripMenuItem.cs @@ -121,12 +121,6 @@ public class SearchToolStripMenuItem private void RegisterEvents() { - // Resets the search filter - // ParentDropDown.Opening += async (sender, args) => - // { - // await _onSearchTextChanged.Invoke(""); - // }; - ParentDropDown.ItemClicked += (sender, args) => { // we are not closing the dropdown only if user clicked the first item of the dropdown which is TextBox that we use for search @@ -138,8 +132,14 @@ public class SearchToolStripMenuItem ParentDropDown.Close(); }; - ParentDropDown.Closed += (sender, args) => + // Resets the list with empty search texts, otherwise on next menu pop up we end up with latest state + ParentDropDown.Closed += async (sender, args) => { + // clear list only if search text is not null + if (SearchText != null) + { + await _onSearchTextChanged.Invoke(""); + } SearchText = null; }; }