-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(IBrowserFingerService): add GetClientHubIdAsync method #6551
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
Conversation
Reviewer's GuideThis PR introduces a new GetClientHubIdAsync method across the BrowserFinger service, implements it in the default service and JS utility module, and updates the sample component to fetch and display the client hub connection ID, along with minor UI and fallback operator tweaks. Sequence diagram for GetClientHubIdAsync flow in BrowserFingers componentsequenceDiagram
participant BrowserFingers as BrowserFingers Component
participant BrowserFingerService as IBrowserFingerService
participant DefaultBrowserFingerService
participant JSModule
participant JSUtility as utility.js
BrowserFingers->>BrowserFingerService: GetClientHubIdAsync()
BrowserFingerService->>DefaultBrowserFingerService: GetClientHubIdAsync()
DefaultBrowserFingerService->>JSModule: LoadUtility()
JSModule->>JSUtility: getClientHubId()
JSUtility-->>JSModule: clientHubId (from localStorage)
JSModule-->>DefaultBrowserFingerService: clientHubId
DefaultBrowserFingerService-->>BrowserFingerService: clientHubId
BrowserFingerService-->>BrowserFingers: clientHubId
Class diagram for IBrowserFingerService and DefaultBrowserFingerService changesclassDiagram
class IBrowserFingerService {
+Task<string?> GetFingerCodeAsync(CancellationToken token = default)
+Task<string?> GetClientHubIdAsync(CancellationToken token = default)
}
class DefaultBrowserFingerService {
+Task<string?> GetFingerCodeAsync(CancellationToken token = default)
+Task<string?> GetClientHubIdAsync(CancellationToken token = default)
}
IBrowserFingerService <|.. DefaultBrowserFingerService
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- You added Localizer keys for GetClientHubIdAsync and a new DisplayText for ClientHubId but didn’t update en-US.json or zh-CN.json with those entries—please add the corresponding localization strings.
- The getClientHubId JS function returns only localStorage.getItem('bb_hub_connection_id') without fallback; consider mirroring getClientInfo’s fallback logic or handling nulls so you don’t end up with an unexpected null.
- OnInitializedAsync awaits the two service calls sequentially; you could run GetFingerCodeAsync and GetClientHubIdAsync in parallel (e.g. via Task.WhenAll) to improve load performance.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- You added Localizer keys for GetClientHubIdAsync and a new DisplayText for ClientHubId but didn’t update en-US.json or zh-CN.json with those entries—please add the corresponding localization strings.
- The getClientHubId JS function returns only localStorage.getItem('bb_hub_connection_id') without fallback; consider mirroring getClientInfo’s fallback logic or handling nulls so you don’t end up with an unexpected null.
- OnInitializedAsync awaits the two service calls sequentially; you could run GetFingerCodeAsync and GetClientHubIdAsync in parallel (e.g. via Task.WhenAll) to improve load performance.
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/wwwroot/modules/client.js:27` </location>
<code_context>
if (result) {
data.ip = result.Ip;
}
- data.id = localStorage.getItem('bb_hub_connection_id') ?? result.Id;
+ data.id = localStorage.getItem('bb_hub_connection_id') || result.Id;
return data;
}
</code_context>
<issue_to_address>
Switching from nullish coalescing (??) to logical OR (||) may cause unintended behavior if the stored value is an empty string.
'||' treats empty strings as falsy, so if 'bb_hub_connection_id' is '', it will default to 'result.Id'. Use '??' if you only want to fall back when the value is null or undefined.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6551 +/- ##
===========================================
- Coverage 100.00% 99.93% -0.07%
===========================================
Files 714 715 +1
Lines 31397 31471 +74
Branches 4432 4444 +12
===========================================
+ Hits 31397 31451 +54
- Misses 0 15 +15
- Partials 0 5 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6550
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Introduce a new service method to obtain the client hub connection ID in the browser, integrate it in the default service implementation and JS modules, and update the sample UI and localization to support this feature.
New Features:
Enhancements: