async-library / react-async

🍾 Flexible promise-based React data loader

Home Page:https://docs.react-async.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reset async state to initial

MMauro94 opened this issue · comments

I haven't found any obvious way to reset the async state to its initial state (so that isInitial returns true).

I need this manly because of how dialogs work in the material UI library. I currently use a useEffect to clear all other states of the dialog when it is opened, but there is not a way to do this to the async state, so I'm always left with the state of the last operation.

I advocate adding a reset() function to the AbstractState that takes care of this. Would this be an acceptable way of accomplishing this and be accepted in the project?