Closed avipatel91 closed 6 years ago
I have something here but I don't believe this is the right approach. https://github.com/avipatel91/adex-dapp/commit/3be2ebde7fbaad77cfba9fa9d5c25e47e7bd0057
In order to reset new 'item' state. An item object with the '_type' has to be provided. I used an clean item object from initialState. This item object has '_type' key. This key is then used in the newItemReducer to find a clean item from initialState. We can reduce these steps by just providing type and then newItemReducer would find a clean item from initialState that corresponds to the type.
This behavior is on purpose (in case of accident toggle/close of the form). For every type of new item the state is kept in the memory reducer. I will add "reset form" button or the "reset" can be only on "cancel". Click outside the dialog or on"x" should not clear the form. The form is cleared only on item save at the moment.
Sounds good! I will open up another issue requesting a 'reset button'. If you want me to take it up, I am more than happy to help. =)
A reopened form that was X'ed out will still have old input if there was any.