[task]: Add a "reset" method.
Author: jamestalmageCreated Jun 13, 2026Updated Jul 29, 2026
Should this be an RFC?
- This is not a substantial change
Which package is this a feature request for?
Task (@lit/task)
Description
Use case:
I am implementing a form handler which, upon submission, fires off a task which may succeed or fail (using autoRun:false and calling run manually). Upon failure, I render whatever the appropriate error message is. If they start typing / modifying fields again, I'd like to immediately put the task back in the initial state.
I propose a reset() method that resets all internal state to the initial state.
Alternatives and Workarounds
I could certainly add state fields to the enclosing component to handle this, but then I've got to manage that state field and make sure I'm thinking through all the edge cases.
Source: lit/lit