-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(PopConfirmButton): support trigger OnClose event callback when click document #5889
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
* refactor: 重构代码 * chore: bump version 9.5.11-beta02 --------- Co-Authored-By: AiZhen <[email protected]> Co-Authored-By: Argo Zhang <[email protected]>
# Conflicts: # src/BootstrapBlazor/BootstrapBlazor.csproj
Reviewer's Guide by SourceryThis pull request enhances the Sequence diagram for PopConfirmButton OnClose eventsequenceDiagram
participant User
participant PopConfirmButton
participant JavaScript
User->PopConfirmButton: Click outside popover
PopConfirmButton->JavaScript: EventListener (click outside)
JavaScript->JavaScript: popover.hide()
JavaScript->PopConfirmButton: invoke.invokeMethodAsync(closeCallback)
PopConfirmButton->PopConfirmButton: TriggerCloseCallback()
PopConfirmButton->PopConfirmButton: OnClose()
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:
Overall Comments:
- Consider adding a try-catch block around the
OnConfirmandOnClosecallbacks to prevent exceptions from breaking the component.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5889 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 661 661
Lines 30412 30430 +18
Branches 4319 4323 +4
=========================================
+ Hits 30412 30430 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #5888
Summary By Copilot
This pull request introduces enhancements and bug fixes for the
PopConfirmButtoncomponent in theBootstrapBlazorlibrary. Key updates include improvements to the JavaScript interop for managing callbacks, removal of defaultOnConfirmandOnCloseassignments, and additional safety checks. Below is a detailed breakdown of the changes:Component Behavior Enhancements:
PopConfirmButtonBase.cs: Removed default assignments forOnConfirmandOnCloseto allow for null values and added aTriggerCloseCallbackmethod to handleOnCloseevents via JavaScript interop. TheInvokeInitAsyncmethod was also updated to pass theOnClosecallback to the JavaScript initialization function.PopConfirmButton.razor.cs: Added null checks forOnConfirmbefore invoking it in theOnClickConfirmmethod to prevent potential runtime errors. [1] [2]JavaScript Interop Improvements:
PopConfirmButton.razor.js: Enhanced theinitfunction to acceptinvokeandcloseCallbackparameters for better callback handling. Updated thedisposefunction to clean up event listeners and added logic to invoke thecloseCallbackwhen hiding the popover. [1] [2] [3] [4]Code Simplifications and Safety Updates:
PopConfirmButtonBase.cs: Removed[NotNull]attributes fromOnConfirmandOnCloseproperties to align with the removal of default assignments and improve null-safety handling. [1] [2]Version Update:
BootstrapBlazor.csproj: Updated the project version from9.5.11-beta03to9.5.11-beta04.Related Updates in Other Components:
TableExtensionButton.razor.csandTableToolbar.razor.cs: Added null checks forOnConfirmcallbacks to ensure they are invoked only when defined. [1] [2]Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enhance PopConfirmButton component by improving JavaScript interop, adding null-safety for callbacks, and supporting OnClose event triggering
New Features:
Bug Fixes:
Enhancements: