Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ protected override async Task OnInitialLoadedAsync()
(Func<LocalModelFile, bool>)(
file =>
string.IsNullOrWhiteSpace(SearchQuery)
|| (
SearchQuery.StartsWith("#")
&& (
file.ConnectedModelInfo?.Tags.Contains(
SearchQuery.Substring(1),
StringComparer.OrdinalIgnoreCase
) ?? false
Comment on lines +219 to +222
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding an explicit null check for file.ConnectedModelInfo?.Tags before calling Contains. While the ?? false handles the null case, an explicit check would improve readability and make the intent clearer.

Also, it might be beneficial to add a comment explaining why StringComparer.OrdinalIgnoreCase is used for the tag comparison. This clarifies the intended behavior, especially if there are other comparison options to consider.

                                    file.ConnectedModelInfo?.Tags != null && file.ConnectedModelInfo.Tags.Contains(
                                        SearchQuery.Substring(1),
                                        StringComparer.OrdinalIgnoreCase // Case-insensitive comparison for tag search
                                    ) ?? false

)
)
|| file.DisplayModelFileName.Contains(
SearchQuery,
StringComparison.OrdinalIgnoreCase
Expand Down
Loading