Skip to content
Merged
Show file tree
Hide file tree
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
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.0.5</Version>
<Version>9.0.6</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public partial class SelectCity
private string? _searchText;

private string? GetActiveClass(string item) => CssBuilder.Default()
.AddClass("active", _values.Contains(item) || CurrentValue == item)
.AddClass("active", _values.Contains(item) && IsMultiple)
.AddClass("active", CurrentValue == item && !IsMultiple)
Comment on lines +56 to +57
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

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

The two separate AddClass calls for the same CSS class 'active' could be combined into a single call with a more readable condition. Consider: .AddClass('active', (IsMultiple && _values.Contains(item)) || (!IsMultiple && CurrentValue == item))

Suggested change
.AddClass("active", _values.Contains(item) && IsMultiple)
.AddClass("active", CurrentValue == item && !IsMultiple)
.AddClass("active", (IsMultiple && _values.Contains(item)) || (!IsMultiple && CurrentValue == item))

Copilot uses AI. Check for mistakes.
.AddClass("prev", !string.IsNullOrEmpty(_searchText) && PinYinService.GetFirstLetters(item).StartsWith(_searchText))
.Build();

Expand All @@ -65,6 +66,11 @@ protected override void OnParametersSet()
base.OnParametersSet();

SearchIcon ??= IconTheme.GetIconByKey(ComponentIcons.SelectSearchIcon);

if (!IsMultiple)
{
_values.Clear();
Comment on lines +70 to +72
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Clearing _values on every parameter set may unintentionally remove user selections.

Clearing _values each time may erase user selections if OnParametersSet runs multiple times. Consider restricting this to cases where IsMultiple transitions from true to false.

}
}

/// <summary>
Expand Down