Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the BaseLayout voting toast behavior so that the vote prompt timeout is skipped when running in a development/debug environment, while preserving existing behavior in non-debug builds, and wires the new JS parameter through from the .NET layout component. Sequence diagram for BaseLayout vote toast behavior with debug flagsequenceDiagram
actor Browser
participant BlazorBaseLayout
participant JSRuntime
participant JSModule
Browser->>BlazorBaseLayout: Initial render
activate BlazorBaseLayout
BlazorBaseLayout->>JSRuntime: LoadModule(Layout/BaseLayout.razor.js)
JSRuntime-->>BlazorBaseLayout: JSModule
BlazorBaseLayout->>JSModule: doTask(_interop, IsDevelopment)
deactivate BlazorBaseLayout
activate JSModule
JSModule->>JSModule: initTheme()
JSModule->>JSModule: read localStorage bb-gitee-vote
alt bb-gitee-vote is false
JSModule->>JSModule: remove bb-gitee-vote
end
alt IsDevelopment is false
JSModule->>JSModule: setTimeout(ShowVoteToast, 10000)
JSModule-->>BlazorBaseLayout: invokeMethodAsync ShowVoteToast
else IsDevelopment is true
JSModule->>JSModule: skip vote toast timeout
end
Browser->>JSModule: click #bb-gitee-vote
JSModule->>BlazorBaseLayout: invokeMethodAsync ShowVoteWithGoto
JSModule->>Browser: hide toast
Browser->>BlazorBaseLayout: navigate to vote link
deactivate JSModule
Flow diagram for updated doTask vote toast logicflowchart TD
A_start([start doTask]) --> B_initTheme[initTheme]
B_initTheme --> C_getVote[Get bb-gitee-vote from localStorage]
C_getVote --> D_checkVote{bb-gitee-vote exists?}
D_checkVote -- yes --> E_parseVote[Parse as boolean]
E_parseVote --> F_checkFalse{value is false?}
F_checkFalse -- yes --> G_removeVote[Remove bb-gitee-vote]
F_checkFalse -- no --> H_skipRemove[Keep bb-gitee-vote]
D_checkVote -- no --> H_skipRemove
G_removeVote --> I_checkDebug{debug !== true?}
H_skipRemove --> I_checkDebug
I_checkDebug -- yes --> J_setTimeout[setTimeout 10s]
J_setTimeout --> K_invokeToast[invokeMethodAsync ShowVoteToast]
I_checkDebug -- no --> L_skipTimeout[Skip vote toast timeout]
K_invokeToast --> M_attachClick[Attach click handler for #bb-gitee-vote]
L_skipTimeout --> M_attachClick
M_attachClick --> N_onClick[On click: invoke ShowVoteWithGoto,
close toast, navigate]
N_onClick --> O_end([end])
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.
Hey there - I've reviewed your changes - here's some feedback:
- The new
debugparameter name indoTaskdoesn’t clearly match theIsDevelopmentvalue being passed from C#; consider renaming it to something likeisDevelopment(and updating the conditional accordingly) to make its intent clearer to future readers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `debug` parameter name in `doTask` doesn’t clearly match the `IsDevelopment` value being passed from C#; consider renaming it to something like `isDevelopment` (and updating the conditional accordingly) to make its intent clearer to future readers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR prevents the vote notification toast from appearing when the application runs in a development/debug environment, addressing issue #7314.
Key changes:
- Added a development environment check parameter to the JavaScript
doTaskfunction - Conditionally skip showing the vote toast when in development mode
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/BootstrapBlazor.Server/Components/Layout/BaseLayout.razor.js | Added debug parameter to doTask function and wrapped the vote toast timer in a conditional check to skip execution in development mode |
| src/BootstrapBlazor.Server/Components/Layout/BaseLayout.razor.cs | Passed WebsiteOption.Value.IsDevelopment as a second parameter to the doTask JavaScript function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| export function doTask(invoke) { | ||
| export function doTask(invoke, debug) { |
There was a problem hiding this comment.
The parameter name "debug" is inconsistent with the C# property name "IsDevelopment" being passed from BaseLayout.razor.cs. Consider renaming the parameter to "isDevelopment" to better reflect what it represents and maintain naming consistency across the codebase.
| await invoke.invokeMethodAsync("ShowVoteToast"); | ||
| }, 10000); | ||
|
|
||
| if (debug !== true) { |
There was a problem hiding this comment.
The parameter name "debug" is inconsistent with the C# property name "IsDevelopment" being passed from BaseLayout.razor.cs. Consider renaming to "isDevelopment" to better reflect what it represents and maintain naming consistency across the codebase.
Link issues
fixes #7314
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Bug Fixes: