Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

refactor(vOnClickOutside): use weakMap for stop function instead of mutating element #4755

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

Merged
merged 2 commits into from
May 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Add logic to call stop.stop when stop is not a function
  • Loading branch information
jsy-0526 committed May 15, 2025
commit a5fd423b3aa2ccdd9e1ebeb3330b1b423ed75af7
3 changes: 3 additions & 0 deletions 3 packages/core/onClickOutside/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const vOnClickOutside: ObjectDirective<
if (stop && typeof stop === 'function') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it isn't a function, it means controls was true, right?

so we should just call stop() on it I think:

if (typeof stop === 'function') {
  stop();
} else {
  stop.stop(); // but call the variable something better
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for your reply!

Yes, you're right. I overlooked this logic branch and I will add this new logic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added this logic. thx you for your guidance!

stop()
}
else {
stop?.stop()
}
stopClickOutsideMap.delete(el)
},
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.