-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
Description
Describe the bug
The leading
option for refThrottled
seems to be getting ignored and acting like it's true
always.
In the reproduction I've got a throttle of 1 second and two buttons. Once that switches a bool from false -> true -> false in 2 seconds and one that switches it in 0.2 seconds.
On both the throttled value updates immediately even though the throttle is set to 1 second. I would expect the "quick" button to never change the throttled value and the "slow" button to change it only after a second.
I'll attempt to look into the code further tomorrow and see if I can find out exactly what's causing this (and if I can make a PR for it)
Reproduction
https://stackblitz.com/edit/vitejs-vite-asunqxu2?file=src%2FApp.vue
System Info
System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 13.65 GB / 31.01 GB
Container: Yes
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/.volta/tools/image/node/20.10.0/bin/node
Yarn: 4.1.0 - ~/.volta/tools/image/yarn/4.1.0/bin/yarn
npm: 10.9.1 - ~/.volta/tools/image/npm/10.9.1/bin/npm
pnpm: 9.6.0 - ~/.volta/tools/image/pnpm/9.6.0/bin/pnpm
Browsers:
Chrome: 132.0.6834.159
Chromium: 132.0.6834.83
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.