Skip to content

BUG | refThrottled | The option leading: false seems to be ignored #4551

@Flambe

Description

@Flambe

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions