Conversation
Reviewer's GuideSelectCity search now reduces interop and filtering overhead through debouncing, duplicate suppression, and per-instance cached pinyin/filter indexes, while stable render keys preserve UI state and bUnit tests cover Chinese, pinyin, and cleared searches without changing the public API or selection behavior. Sequence diagram for debounced SelectCity searchsequenceDiagram
participant User
participant SearchInput
participant SelectCityJS
participant SelectCity
User->>SearchInput: type search text
SearchInput->>SelectCityJS: Input.composition
SelectCityJS->>SelectCityJS: debounce
alt input is connected and value is unchanged
SelectCityJS->>SelectCity: invokeMethodAsync(triggerSearch, value)
SelectCity->>SelectCity: TriggerSearch(value)
alt search text changed
SelectCity->>SelectCity: FilterProvinces(searchText)
SelectCity->>SelectCity: StateHasChanged()
else duplicate search
SelectCity-->>SelectCity: return
end
end
Flow diagram for SelectCity search filteringflowchart TD
A[Search text received] --> B{Text changed?}
B -- No --> C[Skip duplicate search]
B -- Yes --> D[Cache filtered provinces]
D --> E{Contains Chinese?}
E -- Yes --> F[Match province and city names]
E -- No --> G[Build or reuse pinyin indexes]
G --> H[Match province and city pinyin]
F --> I[Render filtered provinces]
H --> I
I --> J[Reuse pinyin index for city highlighting]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link issues
fixes #1129
Summary By Copilot
SelectCitysearch input to reduce JavaScript/.NET interop calls during continuous typingRegression?
The public component API, result presentation, and selection behavior remain unchanged.
Risk
The change is isolated to SelectCity search dispatch, filtering, and rendering. Search indexes remain scoped to each component instance so custom service data is not shared across instances.
Verification
Manual (required)
Automated
passed all 4 UnitTestRegion tests on
net10.0checked
SelectCity.razor.jswith Node.js syntax validationchecked the branch diff for whitespace errors
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Improve SelectCity search performance while preserving its public API, presentation, and selection behavior.
Enhancements:
Tests: