-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
Description
Clear and concise description of the problem
The VueUse library currently provides refAutoReset, which resets a ref’s value to its initial state after a specified timeout. However, there are cases where a manual reset is needed instead of an automatic one.
I propose adding a refManualReset utility that allows resetting a ref to its initial value on demand.
Use Cases
- Restoring a ref to its default state after an action is completed.
- Managing UI states that need to be reset programmatically, such as form inputs or temporary status messages.
- Managing pinia state
- Avoiding workarounds like storing the initial value separately.
Suggested solution
const foo = refManualReset('bar')
foo.value // Normal getter
foo.reset() // Resets to the initial value ('bar')Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable