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

Update react-final-form to the latest version 🚀 #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

greenkeeper[bot]
Copy link
Contributor

@greenkeeper greenkeeper bot commented Nov 15, 2018

The dependency react-final-form was updated from 3.7.0 to 4.0.0.

This version is not covered by your current version range.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.


Release Notes for v4.0.0

⚠️ Breaking Changes ⚠️

  • Migrated to new React Context API, so you must be using React v16.3 or higher from now on. #313
Commits

The new version differs by 3 commits.

  • a3e977e 4.0.0
  • 9652024 Required React ^16.3 for new context api
  • 20dbedf Migrate to new React Context API (#313)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper bot 🌴

@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Nov 16, 2018

Update to this version instead 🚀

Release Notes for v4.0.1

Flow Fixes

  • Fixed FieldProps flow problem introduced in v4.0.0 #376 #374
Commits

The new version differs by 2 commits.

See the full diff

greenkeeper bot added a commit that referenced this pull request Nov 16, 2018
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Nov 16, 2018

Update to this version instead 🚀

Release Notes for v4.0.2

Flow Fixes

Commits

The new version differs by 4 commits.

See the full diff

greenkeeper bot added a commit that referenced this pull request Mar 4, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Mar 4, 2019

Update to this version instead 🚀

Commits

The new version differs by 27 commits.

  • 184235b Updated bundle size on readme
  • c96c8a6 updated version
  • 5cae430 Merge branch 'master' of github.com:final-form/react-final-form
  • db204ed upgraded deps
  • 9828131 Setup TS tests (#418)
  • d85a92d Fixed conflicts
  • efb81c2 [email protected] compatibility (#434)
  • e01de85 Expose react context from index, added typescript tests, prepare for React 16.6 (#388)
  • 4885efa Remove . (#424)
  • 2fe9f19 Add Typescript typings for the third argument of the validate function (#429)
  • 286a69b Added helper libs to readme
  • 4ffa1ac Changed MUI example link, as referenced in #389
  • 0974dad Updated material-ui demo (#389)
  • 494276b Update fieldprops documentation (#397)
  • 49b632e Update FieldProps.validate type definition (#413)

There are 27 commits in total.

See the full diff

greenkeeper bot added a commit that referenced this pull request May 15, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 15, 2019

Update to this version instead 🚀

Release Notes for v5.0.0

🎉 v5.0.0 – HOOKS!!! 🎉

First to explain why this change was made... To manage subscriptions to the internal 🏁 Final Form instance, 🏁 React Final Form has been using some legacy lifecycle methods that make the side effect of subscribing to an event emitter cumbersome. Such subscriptions are a perfect use case (no pun intended) for the new React.useEffect() hook. In an effort to modernize and future proof the library, the entire thing has been rewritten to use hooks.

All the previous tests have been rewritten to use 🐐 React Testing Library, which is a superior way to test React components. None of the tests were removed, so all existing functionality from v4 should work in v5, including some optimizations to minimize superfluous additional renders that were made possible by hooks.

⚠️ BREAKING CHANGES 😮

Don't worry...there really aren't that many.

  • Requires ^[email protected]. That's where the hooks are. 🙄
  • All deprecated functions provided in FormRenderProps and FormSpyRenderProps have been removed. They have been spitting warnings at you since v3, so you've probably already corrected for this. The following applies to:
    • batch
    • blur
    • change
    • focus
    • initialize
    • mutators
    • reset

Rather than spreading the FormApi into the render props, you are just given form itself.

v4

<Form onSubmit={submit}>{({ reset }) => (
  // fields here
  <button type="button" onClick={reset}>Reset</button>
)}</Form>

v5

<Form onSubmit={submit}>{({ form }) => (
  // fields here
  <button type="button" onClick={form.reset}>Reset</button>
)}</Form>
  • Field will no longer rerender when the validate prop. Note: it will still always run the latest validation function you have given it, but it won't rerender when the prop is !==. This is to allow the very common practice of providing an inline => function as a field-level validation function. This change will break the very rare edge case where if you are swapping field-level validation functions with different behaviors on subsequent renders, the field will no longer rerender with the new validation errors. The fix for this is to also change the key prop on Field any time you swap the validate function. See this test for an example of what I mean.

😎 New Hook API 😎

Because it was so easy to do, 🏁 React Final Form now exports the useField and useFormState hooks that are used internally in Field and FormSpy respectively. Literally the only thing Field and FormSpy do now is call their hook and then figure out if you are trying to render with the component, render, or children prop.

For example, before v5, if you wanted to create a custom error component that only rerendered when touched or error changed for a field, you'd have to do this:

v4

const Error = ({ name }) => (
  <Field name={name} subscription={{ touched: true, error: true }}>
    {field =>
      field.meta.touched && field.meta.error ? (
        <span>{field.meta.error}</span>
      ) : null
    }
  </Field>
)

...but now you can do:

v5

const Error = ({ name }) => {
  const field = useField(name, { subscription: { touched: true, error: true } })
  return field.meta.touched && field.meta.error ? (
    <span>{field.meta.error}</span>
  ) : null
}

Not too groundbreakingly different, but these hooks might allow for some composability that was previously harder to do, like this clever disgusting hack to listen to multiple fields at once.

Go forth and hook all the things! 🎣


Special thanks to @Andarist for giving me such an extensive code review on #467.

Commits

The new version differs by 14 commits.

  • 35b85b9 5.0.0
  • 376fc69 Removed deprecated api from docs
  • c851c78 Removed misguided hooks docs
  • ffd2003 Hooks!!! (#467)
  • 41d24d6 Added CLI example
  • 45d5e97 Fixed anchor for selective example
  • bfa390e Merge branch 'master' of github.com:final-form/react-final-form
  • 230c169 Upgraded deps and fixed vulnerabily with tar package
  • cb17dc5 Added selective debounce demo
  • e8138a3 Fix onChange TS type signature (#438)
  • 5f036e2 Update readme that warnings do not prevent submit (#447)
  • a3ca5f1 Fixed tslint errors
  • 6cc9b12 Unify TS tests & backport removed typing improvements (#435)
  • d68a91f v4.1.0

See the full diff

greenkeeper bot added a commit that referenced this pull request May 15, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 15, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 15, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 15, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 16, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 16, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 24, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 24, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 24, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 24, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 27, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 27, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 29, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 29, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Jun 11, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Jun 11, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Jun 14, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Jun 14, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Jun 14, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Jun 14, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Jun 19, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Jun 19, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Nov 18, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Nov 18, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Nov 19, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Nov 19, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Nov 19, 2019
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Nov 19, 2019

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Jan 23, 2020
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Jan 23, 2020

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request Mar 30, 2020
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented Mar 30, 2020

Update to this version instead 🚀

greenkeeper bot added a commit that referenced this pull request May 27, 2020
@greenkeeper
Copy link
Contributor Author

greenkeeper bot commented May 27, 2020


🚨 Reminder! Less than one month left to migrate your repositories over to Snyk before Greenkeeper says goodbye on June 3rd! 💜 🚚💨 💚

Find out how to migrate to Snyk at greenkeeper.io


Update to this version instead 🚀

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.

1 participant