You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
vueuse/packages/core/useIdle/index.ts
Line 91 in 04933c9
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
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: