-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(SelectCity): bump version 9.0.9 #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved. | ||||||
| // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved. | ||||||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||||||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||||||
|
|
||||||
|
|
@@ -55,6 +55,7 @@ public partial class SelectCity | |||||
|
|
||||||
| private readonly HashSet<string> _values = []; | ||||||
| private string? _searchText; | ||||||
| private bool _showSearch; | ||||||
|
|
||||||
| private string? GetActiveClass(string item) => CssBuilder.Default() | ||||||
| .AddClass("active", _values.Contains(item) && IsMultiple) | ||||||
|
|
@@ -75,6 +76,32 @@ protected override void OnParametersSet() | |||||
| { | ||||||
| _values.Clear(); | ||||||
| } | ||||||
|
|
||||||
| if (ShowSearch == false) | ||||||
| { | ||||||
| _searchText = ""; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// <inheritdoc/> | ||||||
| /// </summary> | ||||||
| /// <param name="firstRender"></param> | ||||||
| /// <returns></returns> | ||||||
| protected override async Task OnAfterRenderAsync(bool firstRender) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (complexity): Consider removing the _showSearch field and handling ShowSearch changes in OnParametersSetAsync to simplify state management and JS invocation. // Remove the _showSearch field and the OnAfterRenderAsync override entirely.
// Instead, detect ShowSearch changes in OnParametersSetAsync and invoke JS after the render.
private bool _previousShowSearch;
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
// Reset search text when ShowSearch is turned off
if (ShowSearch == false)
{
_searchText = "";
}
// Only call resetSearch JS when ShowSearch actually changes
if (_previousShowSearch != ShowSearch)
{
_previousShowSearch = ShowSearch;
// This will run after the component has rendered the new state
await InvokeVoidAsync("resetSearch", Id, ShowSearch);
}
} |
||||||
| { | ||||||
| await base.OnAfterRenderAsync(firstRender); | ||||||
|
|
||||||
| if (firstRender) | ||||||
| { | ||||||
| _showSearch = ShowSearch; | ||||||
| } | ||||||
|
|
||||||
| if (!_showSearch != ShowSearch) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: The logic in the conditional is confusing and may not behave as intended. The condition uses a double negative, which is unclear and may cause logic errors. Simplifying it to
|
||||||
| if (!_showSearch != ShowSearch) | |
| if (_showSearch != ShowSearch) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,13 +1,14 @@ | ||||||
| import Data from "../../BootstrapBlazor/modules/data.js" | ||||||
| import Data from "../../BootstrapBlazor/modules/data.js" | ||||||
| import EventHandler from "../../BootstrapBlazor/modules/event-handler.js" | ||||||
| import Input from "../../BootstrapBlazor/modules/input.js" | ||||||
| import Popover from "../../BootstrapBlazor/modules/base-popover.js" | ||||||
|
|
||||||
| export function init(id, invoke, options) { | ||||||
| const el = document.getElementById(id) | ||||||
| const el = document.getElementById(id); | ||||||
| if (el === null) { | ||||||
| return | ||||||
|
||||||
| return | |
| return; |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable searchInput is referenced in the callback but is not defined in scope at this point. The searchInput variable is only created later in the initSearch function (line 38), which is called after this popover is initialized.
This will cause a runtime error when the popover is shown. Consider moving the popover initialization to occur after the search input is initialized, or capture the searchInput reference in a way that allows the callback to access it when executed.
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the function call. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see lines 7, 22, 32, etc.), so this should have a semicolon for consistency.
| initSearch(region) | |
| initSearch(region); |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see line 54, 60), so this should have a semicolon for consistency.
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see lines 53-54, 60), so this should have a semicolon for consistency.
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see line 60), so this should have a semicolon for consistency.
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see lines 53-54), so this should have a semicolon for consistency.
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see line 77, 81), so this should have a semicolon for consistency.
| const region = Data.get(id) | |
| const region = Data.get(id); |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see line 76, 81), so this should have a semicolon for consistency.
| Data.remove(id) | |
| Data.remove(id); |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see line 76-77, 84), so this should have a semicolon for consistency.
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon after the statement. While JavaScript has automatic semicolon insertion, the codebase appears to use explicit semicolons consistently (see line 76-77, 81), so this should have a semicolon for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression 'A == false' can be simplified to '!A'.