fix(Select): shoulde keep selected item when OnBeforeSelectedItemChange return false#6052
Merged
fix(Select): shoulde keep selected item when OnBeforeSelectedItemChange return false#6052
Conversation
Co-Authored-By: AApuci <44996451+AApuci@users.noreply.github.com>
Contributor
Reviewer's GuideAdjusts the Select component’s click handler so that if OnBeforeSelectedItemChange returns false, the method exits immediately and the selected item remains unchanged. Sequence Diagram:
|
| Change | Details | Files |
|---|---|---|
| Early exit on OnBeforeSelectedItemChange false result |
|
src/BootstrapBlazor/Components/Select/Select.razor.cs |
Assessment against linked issues
| Issue | Objective | Addressed | Explanation |
|---|---|---|---|
| #6035 | Allow developers to customize the content and presentation of the confirmation dialog when a dropdown selection changes. | ❌ | The PR only fixes a bug where the selected item was not kept when OnBeforeSelectedItemChange returned false. It does not implement the requested feature of a new callback OnSelectedItemChanging that allows for custom dialog content. |
| #6035 | Introduce a new callback OnSelectedItemChanging with old and new SelectedItem parameters to allow developers to freely decide the content and presentation of the confirmation dialog. |
❌ | The PR does not introduce the new callback OnSelectedItemChanging. |
| #6035 | Consider extending similar OnValueChanging callbacks to other form components for consistent handling of value changes and custom dialogs. |
❌ | The PR does not address extending similar callbacks to other form components. |
Possibly linked issues
- feat(Select): 下拉变更前判断优化:自由决定弹框内容。 #6035: The PR modifies the Select component's OnClickItem method to prevent further execution when OnBeforeSelectedItemChange returns false, fixing issue feat(Select): 下拉变更前判断优化:自由决定弹框内容。 #6035.
- feat(Select): 下拉变更前判断优化:自由决定弹框内容。 #6035: The PR fixes the Select control's selection logic, likely resolving the unresponsiveness and double event trigger in the issue.
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summaryon the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Contributor
There was a problem hiding this comment.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 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 #6052 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 701 701
Lines 30958 30957 -1
Branches 4378 4378
=========================================
- Hits 30958 30957 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
|
@ArgoZhang 抱歉我又来了,目前的处理代码在以下情况下还是会有问题: 另外:目前swal 处理在弹出的表单编辑中可能会有层级显示问题,所以我觉得大佬内部封装这种处理,后面可能会出现其它不可估量的问题。 |
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 #6035
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Bug Fixes: