Compare commits

...

3 Commits

Author SHA1 Message Date
Mike Griese
4c95b82964 Revert "A thought for #38140, but not one we need right now"
This reverts commit 56f27d0fd8.
2025-03-25 09:01:27 -05:00
Mike Griese
56f27d0fd8 A thought for #38140, but not one we need right now 2025-03-25 09:00:55 -05:00
Mike Griese
ef5a4f9ec4 Prevent fallbacks with whitespace-only names from appearing in list
Re-orders some of the NullOrEmpty vs NullOrWhitespace checks to make
sure that the fallback items get updated for a whitespace query, but
then don't get shown if they aren't needed

Closes #38133
2025-03-25 06:28:50 -05:00

View File

@@ -109,7 +109,7 @@ public partial class MainListPage : DynamicListPage,
} }
// Cleared out the filter text? easy. Reset _filteredItems, and bail out. // Cleared out the filter text? easy. Reset _filteredItems, and bail out.
if (string.IsNullOrEmpty(newSearch)) if (string.IsNullOrWhiteSpace(newSearch))
{ {
_filteredItems = null; _filteredItems = null;
RaiseItemsChanged(commands.Count); RaiseItemsChanged(commands.Count);
@@ -133,8 +133,9 @@ public partial class MainListPage : DynamicListPage,
// Produce a list of everything that matches the current filter. // Produce a list of everything that matches the current filter.
_filteredItems = ListHelpers.FilterList<IListItem>(_filteredItems, SearchText, ScoreTopLevelItem); _filteredItems = ListHelpers.FilterList<IListItem>(_filteredItems, SearchText, ScoreTopLevelItem);
RaiseItemsChanged(_filteredItems.Count());
} }
RaiseItemsChanged(_filteredItems.Count());
} }
private bool ActuallyLoading() private bool ActuallyLoading()
@@ -149,13 +150,13 @@ public partial class MainListPage : DynamicListPage,
// _always_ show up first. // _always_ show up first.
private int ScoreTopLevelItem(string query, IListItem topLevelOrAppItem) private int ScoreTopLevelItem(string query, IListItem topLevelOrAppItem)
{ {
if (string.IsNullOrWhiteSpace(query)) if (string.IsNullOrEmpty(query))
{ {
return 1; return 1;
} }
var title = topLevelOrAppItem.Title; var title = topLevelOrAppItem.Title;
if (string.IsNullOrEmpty(title)) if (string.IsNullOrWhiteSpace(title))
{ {
return 0; return 0;
} }