Skip to content

BUG | useIdle | initialState ignored #4799

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

Open
7 tasks done
dennismuench opened this issue Jun 6, 2025 · 0 comments · May be fixed by #4800
Open
7 tasks done

BUG | useIdle | initialState ignored #4799

dennismuench opened this issue Jun 6, 2025 · 0 comments · May be fixed by #4800

Comments

@dennismuench
Copy link

Describe the bug

Hi there,

I just came across the following:

If you want the initial state to be true (i.e., the user is idle) and you want to wait for the first interaction before starting the timer, you would set option initialState to true. However, because the reset() method inside the useIdle function is always called at the end, the initialState will always be overwritten to false.

Therefore, it has no effect.

I guess only calling the initial reset() method when initialState is false would solve the issue.

Reproduction

https://playground.vueuse.org/#eNp9kstuwjAQRX/F8iZUiggSXdGA+hALumirUnXlTRSGYOrYlh+AFOXfO3YIpFLFKvHcM9d3Rm7ok9bjgwc6o7ktDdeOWHBeE1HIas6os4wumOS1VsaRhngLq40A0pKtUTVJHrEXa1mpDCQD7li4cnehEEoemGSyVNIGmXce895vNJ1MJmkQJHe8EGtXOJgRZzxid9fOoYzdwWZ8KIQHdI9XjkIpJfHzHYQ7Ml+Q0KwQFaoaJZ13ksbujsEb8qwbH4fFg4NaC8TwlOvFCm8tBDmHav6mJG2bZ/oMomMHxPl6IRvY0RR3inm2vBrvrZK4+IZJQhgtVa25APOuHce8jKJTUIJWCKGOr7EWdpL29XIH5c8/9b09hRqjHwYsmAMwetFcYSpwnbxcv8EJ/y9irTZeIH1D/ATcpQ8ZO+zZS5zWDLiYdhWfApfVl12eHEjbDxWCBrKNPKP4OF5ujH6NOx3fxz4mW9r+AmYb6+E=

System Info

System:
    OS: macOS 15.5
    CPU: (10) arm64 Apple M2 Pro
    Memory: 123.09 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.1 - ~/.nvm/versions/node/v22.13.1/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.13.1/bin/npm
    pnpm: 10.5.2 - ~/.nvm/versions/node/v22.13.1/bin/pnpm
    bun: 1.1.21 - ~/.bun/bin/bun
  Browsers:
    Chrome: 137.0.7151.69
    Safari: 18.5
  npmPackages:
    @vueuse/core: ^13.3.0 => 13.3.0 
    vue: ^3.5.13 => 3.5.16

Used Package Manager

pnpm

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants