fix: replace throttle in useScroll with watchThrottled for shadow DOM…#111
Conversation
WalkthroughThe code updates how scrolling state is tracked in a Vue component. Instead of using the throttle option in Changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/components/src/suggestion-popover/index.vueOops! Something went wrong! :( ESLint: 9.28.0 Error: The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it. ✨ 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 (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/components/src/suggestion-popover/index.vue (1)
96-105: Minor clean-up: capture the stop-handle returned bywatchThrottled
watchThrottledreturns a disposer that Vue will usually auto-collect under<script setup>, but explicitly storing it increases clarity and lets you stop the watcher manually should the need arise (e.g., when toggling virtual scrollers).const { isScrolling: listScrolling } = useScroll(listRef) -watchThrottled( +const stopScrollingWatcher = watchThrottled( listScrolling, (value) => { isScrolling.value = value }, { throttle: 100, leading: true, trailing: true }, )Not critical, yet improves maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/components/src/suggestion-popover/index.vue(2 hunks)
🔇 Additional comments (1)
packages/components/src/suggestion-popover/index.vue (1)
2-9:Details
✅ Verification successful
Ensure
watchThrottledexists in the installed@vueuse/coreversion
watchThrottledlanded in @vueuse/core v9.1.0.
If the repository is still on an older minor, this import will break the build.Run the quick check below to confirm the declared version in package.json (or pnpm-lock / yarn.lock):
🏁 Script executed:
#!/bin/bash # Print the declared vueuse version so we know whether watchThrottled is available jq -r '.dependencies["@vueuse/core"] // .devDependencies["@vueuse/core"]' package.jsonLength of output: 93
🏁 Script executed:
#!/bin/bash echo "1. Searching for @vueuse/core in all package.json files" find . -type f -name 'package.json' -exec grep -n '"@vueuse/core"' {} \; || true echo echo "2. Checking lockfiles for installed @vueuse/core versions" for lockfile in pnpm-lock.yaml yarn.lock package-lock.json; do if [ -f "$lockfile" ]; then echo "$lockfile:" grep -n "@vueuse/core@" "$lockfile" || echo " No entries found" fi doneLength of output: 628
No action required —
watchThrottledis supported in @vueuse/core v13.1.0
Verified that package.json declares"@vueuse/core": "^13.1.0", which is ≥ 9.1.0.
… compatibility
Summary by CodeRabbit