-
-
Notifications
You must be signed in to change notification settings - Fork 236
fix: no warning #561
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: no warning #561
Conversation
Walkthrough本次更改调整了 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 分钟 Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #561 +/- ##
=======================================
Coverage 97.75% 97.75%
=======================================
Files 12 12
Lines 801 801
Branches 235 243 +8
=======================================
Hits 783 783
Misses 18 18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -53,8 +53,8 @@ export default function useWinClick( | |||
} | |||
|
|||
// Warning if target and popup not in same root | |||
if (process.env.NODE_ENV !== 'production') { | |||
const targetRoot = targetEle?.getRootNode?.(); | |||
if (process.env.NODE_ENV !== 'production' && targetEle) { |
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.
这样会不会导致这部分代码不会从 production 环境移除,从而使体积变大?
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.
uglify 会短路,中间有 falsy 就会删掉。
在 #528 中,剥离了
isMobile
检测降低 bundle size,使用更通用的方式进行自动切换。这使得在 hoverToClose 中也会添加一个 touchToClose 逻辑,从而走 shadowRoot 的检测。在 React 18 中,setState 后会立刻触发 useEffect。而在 19 则会合并触发。这使得 targetElement 在 React 18 中会有一个额外的 useEffect warning 检测,导致 warning。然后在下一个 effect update 便跟上 targetElement,是一个无效 warning。
Summary by CodeRabbit