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

Migrate rest of forms to Final Form #845

Merged
merged 14 commits into from
Jun 6, 2018
Merged

Migrate rest of forms to Final Form #845

merged 14 commits into from
Jun 6, 2018

Conversation

lyyder
Copy link
Contributor

@lyyder lyyder commented May 23, 2018

Migrate remaining forms from Redux Form to Final Form and remove the redux-form dependency. Also now all the form components can be found in the src/forms folder.

The gzipped bundle size was reduced from 501.46 KB to 474.07 KB.

<FormSpy onChange={handleChange} subscription={{ values: true, dirty: true }} />
<FieldCheckboxGroup
name={name}
id={`${name}-filter`}
Copy link
Contributor

@Gnito Gnito May 31, 2018

Choose a reason for hiding this comment

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

I have used either same string as in the name props or if the form is used several times, I have passed in a formId

id={formId ? `${formId}.phoneNumber` : 'phoneNumber'}

(If the name prop is already a good enough string, there's probably no need to differentiate name and id. One is used to identify form field "keys" and another for DOM element selection.)

<FinalForm
{...rest}
mutators={{ ...arrayMutators }}
onSubmit={vals => console.log('SelectMultipleFilterPlainForm', vals)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably unnecessary

@Gnito
Copy link
Contributor

Gnito commented May 31, 2018

I didn't check this yet fully but looks OKish (you need to update changelog.md)
Also, it might be good to push this branch to stage and test with mobile phones.

@lyyder lyyder temporarily deployed to sharetribe-starter-app June 1, 2018 05:27 Inactive
return (
<FinalForm
{...props}
render={({ rootClassName, className, intl, handleSubmit }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't used this spread format of props with other components. It helps to debug code if there's full prop list available.

<Field
name="location"
format={null}
render={({ input, meta }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't used this spread format of props with other components. It helps to debug code if there's full prop list available.

{...rest}
onSubmit={() => null}
mutators={{ ...arrayMutators }}
render={({ className, name, options, twoColumns, onChange }) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't used this spread format of props with other components. It helps to debug code if there's full prop list available.

<Field
name="location"
format={null}
render={({ input, meta }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't used this spread format of props with other components. It helps to debug code if there's full prop list available.

Copy link
Contributor

@Gnito Gnito left a comment

Choose a reason for hiding this comment

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

This looks good!
The one thing that I'd want to change is props spreading. Now that I started to think about this, we have had a rule to not spread props since that makes debugging harder (only picked props are easily available in inspector).

And one ToDo thing (sometime later) is to fix my mistake of using the word fieldRenderProps in all the previous forms.

Change props spreading so that the whole props object is available to
the form and required props can be destructured from that.
@lyyder
Copy link
Contributor Author

lyyder commented Jun 1, 2018

@Gnito The form props spreading/destructuring has now been changed so that all the forms provide the formRenderProps in the render function.

@lyyder lyyder temporarily deployed to sharetribe-starter-app June 6, 2018 23:01 Inactive
@lyyder lyyder merged commit 6be5c31 into master Jun 6, 2018
@lyyder lyyder deleted the final-form-migration branch June 6, 2018 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants