Search code examples
reduxredux-form

Prevent redux-form from destruction/updating


I am using redux-form and at some point destroy event is fired probably due to some state change, hard to say. I am using redux-dev-tools and there, if I eliminate this event, it fixes the behavior of the form. If I look into trace (redux-dev-tools) section of the destroy event it does not show any of my code, so I am having real trouble tracing it down. I am looking for either a way to trace down what is the root reason for the destroy event in my code or just prevent all form updates after Submit button is hit.

The actual issue is documented here: https://github.com/macarthur-lab/seqr/issues/1334


Solution

  • From these 2 threads:

    https://github.com/redux-form/redux-form/issues/2982

    https://github.com/redux-form/redux-form/issues/603#issuecomment-295043224

    I figured to supply destroyOnUnmount: false property to my redux form and it worked. To prevent saving form details when we go away from page and go back, I added enableReinitialize parameter also.