Skip to content

Commit cda1b00

Browse files
committed
Refactor QueryText clearing logic in MainViewModel
Simplified the process of clearing the `QueryText` property by replacing manual updates to the `_queryText` private field and `QueryTextBox` control with the use of the `QueryText` property setter. This change avoids triggering duplicate query calls while maintaining the intended behavior. Updated comments to reflect the new approach.
1 parent d774342 commit cda1b00

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -884,13 +884,8 @@ private ResultsViewModel SelectedResults
884884
}
885885
_queryTextBeforeLeaveResults = QueryText;
886886

887-
// We use private field and manually set QueryTextBox instead of QueryText setter
888-
// so that QueryTextBox_TextChanged1 will not be invoked to avoid duplicated Query calls
889-
_queryText = string.Empty;
890-
if (Application.Current?.MainWindow is MainWindow mainWindow)
891-
{
892-
mainWindow.SetQueryTextBoxText(string.Empty);
893-
}
887+
// We can use QueryText setter because the Query as follows does not requery
888+
QueryText = string.Empty;
894889

895890
// Because of Fody's optimization
896891
// setter won't be called when property value is not changed.

0 commit comments

Comments
 (0)