Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Form Initialization from Record #5146

Merged
merged 2 commits into from
Aug 21, 2020

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Aug 12, 2020

Fixes #4954

@djhi djhi added this to the 3.8.2 milestone Aug 12, 2020
});
const initialValues = form.getState().initialValues;
const initialValuesMergedWithRecord = merge({}, initialValues, record);
form.initialize(initialValuesMergedWithRecord);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is neat but there is a difference with the previous code: you initialize values including the ones for which there is no associated input. You put that restriction in 3e56efe. Are you sure you're not reintroducing a bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find any

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including the one from #3721?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add some tests tomorrow

@fzaninotto
Copy link
Member

ping

@djhi djhi force-pushed the fix-form-initialization-from-record branch from 1373500 to 20c9a90 Compare August 20, 2020 14:39
@djhi djhi requested a review from fzaninotto August 20, 2020 15:10
@fzaninotto fzaninotto merged commit 64d48a5 into master Aug 21, 2020
@fzaninotto fzaninotto deleted the fix-form-initialization-from-record branch August 21, 2020 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirect from create to edit can have a wrong pristine due to optimistic rendering
2 participants