-
Notifications
You must be signed in to change notification settings - Fork 281
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
fix(modal): [modal] modifying the modal component and clicking the confirm button accidentally triggered the close event #2727
Conversation
…cidentally triggered the close event
WalkthroughThe pull request introduces modifications to the modal component's event handling in the Changes
Suggested labels
Suggested reviewers
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
WalkthroughThis pull request addresses a bug in the modal component where clicking the confirm button inadvertently triggered the close event. The changes ensure that the close event is not emitted when it is not intended, thus fixing the unintended behavior. Changes
|
@@ -207,7 +207,7 @@ export const handleEvent = | |||
params.options = options | |||
} | |||
|
|||
type !== 'close' && emit(type, params, event) | |||
emit(type, params, event) |
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.
Ensure that removing the condition for emitting 'close' does not lead to unintended side effects, such as triggering the 'close' event in scenarios where it should not be triggered.
[e2e-test-warn] The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug". Please make sure you've read our contributing guide |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/renderless/src/modal/index.ts (1)
210-212
: Consider making the modal closure optional on certain events.Currently, this logic emits the event (e.g.,
'confirm'
) and then immediately callsapi.close(type)
unconditionally. While this may be suitable for many use cases, it might be too restrictive in scenarios where confirming an action should not automatically close the modal. To improve flexibility, consider introducing an optional parameter, or using an after-confirm callback, to decide whether to close the modal.🧰 Tools
🪛 Biome (1.9.4)
[error] 211-211: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
…cidentally triggered the close event
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit