You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a problem with React 16 and the way redux-form handles the initializing and destroying of the forms in their components lifecycle
What you were expecting:
I am linking from an edit page with a form to a create page with a form passing some values by the query parameters. I am trying to fill these parameters as default values to the form. That's how I found this.
What happened instead:
It looks like the destroyOnUnmount function of redux-form destroys the form after it has been initalized.
Maybe this comes somewhere between redux-form 6.6.3 which is used in aor 1.2.1 and redux-form 7.0.4
I had problems recreating this bug in the older version of admin-on-rest which is included in the CodeSandbox you're refering to: https://codesandbox.io/s/ElxGNxBY0
It seems to work with admin-on-rest 1.2.1. I have made a branch in the repo for this.
But updating the dependencies in the CodeSandbox seem to break the code, that's why I just created the sample application.
Steps to reproduce:
Click on comments list.
Click an create.
See the initial value for the body.
Then:
Click on posts list.
Edit any Post.
Click on "Add Comment" in the action bar.
The body value should have a default value 'Test Body' but it doesnt. (I am not actually using any of the query parameters, I made this link just to show me use case for why I built it)
Debugging the redux store shows the destruction of the record-form
1.4.0:
1.2.1:
Environment
Admin-on-rest version: 1.5.0
Last version that did not exhibit the issue (if applicable):
The text was updated successfully, but these errors were encountered:
As I am using a customized version of admin-on-rest anyway I hacked together a temporary fix which is mentioned here redux-form/redux-form#3435 (comment)
update
All the debugging lead me to this:
redux-form/redux-form#3435
It is a problem with React 16 and the way redux-form handles the initializing and destroying of the forms in their components lifecycle
What you were expecting:
I am linking from an edit page with a form to a create page with a form passing some values by the query parameters. I am trying to fill these parameters as default values to the form. That's how I found this.
What happened instead:
It looks like the destroyOnUnmount function of redux-form destroys the form after it has been initalized.
Maybe this comes somewhere between redux-form 6.6.3 which is used in aor 1.2.1 and redux-form 7.0.4
Related code:
See an example application here:
https://github.com/nik-lampe/admin-on-rest-form-destruction
I had problems recreating this bug in the older version of admin-on-rest which is included in the CodeSandbox you're refering to: https://codesandbox.io/s/ElxGNxBY0
It seems to work with admin-on-rest 1.2.1. I have made a branch in the repo for this.
But updating the dependencies in the CodeSandbox seem to break the code, that's why I just created the sample application.
Steps to reproduce:
Then:
1.4.0:
![admin-on-rest 1.4.0](https://user-images.githubusercontent.com/2122212/37032338-7118326a-2142-11e8-953a-af5846050d68.png)
1.2.1:
![admin-on-rest 1.2.1](https://user-images.githubusercontent.com/2122212/37032333-6c9c6bca-2142-11e8-9f6c-c547be105b11.png)
Environment
The text was updated successfully, but these errors were encountered: