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

Formik v3 Umbrella PR. #3231

Open
wants to merge 94 commits into
base: main
Choose a base branch
from
Open

Formik v3 Umbrella PR. #3231

wants to merge 94 commits into from

Conversation

johnrom
Copy link
Collaborator

@johnrom johnrom commented Jun 4, 2021

Note: Formik no longer appears maintained, but I am leaving this PR open for archival purposes.

closes #3099

Todo:

  • Merge main
  • React Native Batching
  • Documentation

johnrom and others added 30 commits March 8, 2021 18:28
Added Ref State.
Added useSelectorComparer.
Starting to build subscriptions.
use-subscriptions might not work in React 17? Seems returning the previous value doesn't bail out the render.
Sync up formik-native and formik for v3.
…te will do. If we call our own reducer then use useReducer dispatch, `state.values !== getState().values`.
…ormikReducerState + FormikComputedState.

Add Fixtures and Tutorial code to /app.
Consolidate State and Add Tutorial + Fixtures.
For some reason, the tests for remove only worked when they were async or render was moved from beforeEach to the individual tests.
@kuzaxak
Copy link

kuzaxak commented Jan 23, 2022

Hi, do you have any plans with that v3 version? Or maybe you need some help?

We would like to use v3 in our application and try to figure out what is the best way to do so.

@johnrom
Copy link
Collaborator Author

johnrom commented Jan 24, 2022

@kuzaxak this PR is complete as far as I know. I requested Formik release it as an official RC so it can get more testing done, but there has been no movement there. Unfortunately I'm fully loaded up on client work at the moment, so I haven't decided where to go next.

@jonstuebe
Copy link

Would love to see the RC published! I have a decent size monorepo that I can help test things on and give feedback on perf and such.

@kuzaxak
Copy link

kuzaxak commented Jan 24, 2022

@kuzaxak this PR is complete as far as I know. I requested Formik release it as an official RC so it can get more testing done, but there has been no movement there. Unfortunately I'm fully loaded up on client work at the moment, so I haven't decided where to go next.

I see that you published it as rc under your own npm package, can we use it? Or we need to use git dependency?

@johnrom
Copy link
Collaborator Author

johnrom commented Jan 24, 2022

Feel free to test my RC via npm with @johnrom/formik-v3@3.0.0-rc1 in order to test and add any issues you may find here, with the following caveats:

  • I will not be providing support to individuals for my RC; any issues you find may or may not be resolved in a timely fashion.
  • Some things are not very well-documented and I probably won't find too much time to answer questions either. The API should be backwards compatible with Formik for the most part with some minor variations (useFormikState, useFormikContext and useFormikConfig have been split). You'll probably need to run through this PR and find subtle differences on your own. The Types will help to identify where pieces of Formik come from in the new system. The helper components like Formik, Form, Field, and ErrorMessage should work just as they did before.
    • for your convenience, here are the docs that I started for my RC. unfortunately, I haven't had time to work on them, but all of the examples have been updated in the code. v3 docs johnrom/formik#11
  • The current npm package is a placeholder because I wanted to make it clear that it's not meant to be a production version. If it were eventually released you'd have to switch back to the final released package.
  • I am not a maintainer of Formik so this PR should not be a general issue repository for Formik itself, only issues with the specific changes made to this PR.

@kuzaxak
Copy link

kuzaxak commented Jan 24, 2022

Feel free to test my RC via npm with @johnrom/formik-v3@3.0.0-rc1 in order to test and add any issues you may find here, with the following caveats:

  • I will not be providing support to individuals for my RC; any issues you find may or may not be resolved in a timely fashion.

  • Some things are not very well-documented and I probably won't find too much time to answer questions either. The API should be backwards compatible with Formik for the most part with some minor variations (useFormikState, useFormikContext and useFormikConfig have been split). You'll probably need to run through this PR and find subtle differences on your own. The Types will help to identify where pieces of Formik come from in the new system. The helper components like Formik, Form, Field, and ErrorMessage should work just as they did before.

    • for your convenience, here are the docs that I started for my RC. unfortunately, I haven't had time to work on them, but all of the examples have been updated in the code. v3 docs johnrom/formik#10
  • The current npm package is a placeholder because I wanted to make it clear that it's not meant to be a production version. If it were eventually released you'd have to switch back to the final released package.

  • I am not a maintainer of Formik so this PR should not be a general issue repository for Formik itself, only issues with the specific changes made to this PR.

This is totally understandable :)

If we will find some problems we always can fork your fork and propose a change.
Thank you for your answers and the work you did!

@johnrom
Copy link
Collaborator Author

johnrom commented Jan 24, 2022

I updated my previous comment to use the correct PR for the documentation. The previous one was the wrong branch. The new PR is here: johnrom#11

@Mikoz93
Copy link

Mikoz93 commented Jan 29, 2022

@jaredpalmer Is there any plan to move this forward? It seems like from the original Todo's, only the documentation remains to be complete. Thanks for your time!

@adam-thomas-privitar
Copy link

adam-thomas-privitar commented Mar 31, 2022

@johnrom Just letting you know the published @johnrom/formik-v3@3.0.0-rc1 package has an incorrect module field in package.json.

Im having trouble using this in place of my existing installation, since useSetFieldValue is not exported. I think probably cos my project is based on top of the beta in main, this isnt reflected in this PR?

@johnrom
Copy link
Collaborator Author

johnrom commented Mar 31, 2022

@adam-thomas-privitar you don't have to use the micro-hooks, you can use useFormikContext().setFieldValue.

The micro-hooks are from the original v3 PR Jared created which optimized the hooks a different way. This one instead removes state from useFormikContext which makes it a stable hook which will not trigger re-renders.

I'll take a look at the package.json when I get a chance.

@johnrom
Copy link
Collaborator Author

johnrom commented Mar 31, 2022

The module issue should be fixed in 3.0.0-rc2.

With the updated module, you can do this after node modules are installed:

import { useField } from '@johnrom/formik-v3';

const MyField = (props) => {
  const [field] = useField(props);

  return <input {...field} />;
}

@adam-thomas-privitar
Copy link

adam-thomas-privitar commented Apr 1, 2022

@adam-thomas-privitar you don't have to use the micro-hooks, you can use useFormikContext().setFieldValue.

The micro-hooks are from the original v3 PR Jared created which optimized the hooks a different way. This one instead removes state from useFormikContext which makes it a stable hook which will not trigger re-renders.

I'll take a look at the package.json when I get a chance.

Yeh I suspected as much! Sadly...Im based on the v3 beta and so have a fair amount of code on top of the "new" hooks. I will need to do a bit more refactoring.

Thanks for fixing the module issue.

… handled anyway. We'd want to dispatch a request to validate specific fields which can be cancelled as more validations are requested.
@vercel
Copy link

vercel bot commented Apr 15, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

formik-docs – ./

🔍 Inspect: https://vercel.com/jared/formik-docs/2LvHDxC73yoFJbQhSLohVRBq3oDr
✅ Preview: Failed

@leoriviera
Copy link

leoriviera commented Apr 29, 2024

@quantizor, noticed you approved a PR for a release that went out a few days ago. This might be great to consider approving, as I've run into #3335 myself! I'm happy to make any changes necessary to resolve any merge conflicts.

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.

v3 Umbrella
9 participants