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

[RFR] Fix create to edit form values #2339

Merged
merged 7 commits into from
Sep 20, 2018
Merged

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Sep 19, 2018

  • Added an e2e test
  • Added a form middleware intercepting location changes
  • Unit test the middleware

Fixes #2324

import { LOCATION_CHANGE } from 'react-router-redux';
import { beforeLocationChange } from '../actions/formActions';

const formMiddleware = () => next => action => {
Copy link
Member

Choose a reason for hiding this comment

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

I and other developers will be unable to understand why you're doing that. This file requires many, many comments to describe the issue and the solution.

@djhi djhi force-pushed the fix-create-edit-form-values branch from a1a93bc to cc16e80 Compare September 19, 2018 19:49
@djhi djhi force-pushed the fix-create-edit-form-values branch 3 times, most recently from a8abdc7 to db7b3c3 Compare September 19, 2018 21:13
@djhi djhi force-pushed the fix-create-edit-form-values branch from db7b3c3 to d9b45d2 Compare September 19, 2018 21:27
@djhi djhi changed the title [WIP] Fix create to edit form values [RFR] Fix create to edit form values Sep 19, 2018
@djhi
Copy link
Collaborator Author

djhi commented Sep 19, 2018

Oh no, now that it is RFR and green, that's the moment you say "Can you target next?", right @fzaninotto? 😭

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

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

I think you must update the CustomApp doc, too.

I'm OK to commit it to master, as the bug is important.

*
* A middleware is needed instead of a saga because we need to control the actions
* order: we need to ensure we reset the redux form BEFORE the location actually
* change. Otherwise, the new page which may contains a record redux-form might
Copy link
Member

Choose a reason for hiding this comment

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

s/change/changes/
s/may contains/may contain/

@djhi
Copy link
Collaborator Author

djhi commented Sep 20, 2018

I think you must update the CustomApp doc, too.

Actually the CustomApp doc was outdated and still referencing the formMiddleware

@fzaninotto
Copy link
Member

Awesome, this makes it a non-BC break change, and therefore totally worthy of the master branch!

@fzaninotto fzaninotto merged commit d0b4744 into master Sep 20, 2018
@fzaninotto fzaninotto deleted the fix-create-edit-form-values branch September 20, 2018 19:23
@fzaninotto fzaninotto added this to the 2.3.2 milestone Sep 20, 2018
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.

3 participants