-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
v3 Umbrella #3099
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
A quick (lol not quick) recap of the purpose and benefits of this Umbrella set of changes which I am recommending for v3: 1. Exposes "future state"You can access future state via <Formik
onSubmit={async (values, api) => {
const result = await checkApiThing();
// make sure these form values aren't stale
const stillRelevant = isEqual(values, api.getState().values);
if (result.success && stillRelevant) {
doImportantStuff(values);
}
}}
/> 2. Brings Optimization to the API level instead of Context level.Bringing the subscription API inside of Formik instead of optimizing at the context level gives us some significant benefits. Does not force users to use Context to receive optimizations.Someone writing their own Form system could just pass the Formik API to a child component and useState() on it to get optimized subscriptions. Enables optional subscriptions
Puts all state updates in the same place.Using This is probably mostly a concurrent mode issue. Not sure if Layout Effects in children are guaranteed to be run in the same render as the parent without a layout effect in legacy or blocking mode. 3. Adds other features which could have also been achieved with useContextSelector.But they would only apply within Context and not outside of Context. Enables Dynamic SlicingThe previous v3 PR didn't give devs a way to dynamically select a cross-section of state. We could do things like <Field
type="number"
name="width"
include={state => ({ height: state.values.height })}
validate={(value, { height }) => value * height > 100
? "Max of 100 square feet."
: ""
}
/> Does not force users to use micro-hooks to access Formik API.In previous v3 PR, a user has to do things like |
is there gonna be a v3 really? |
@keremciu whether my changes are ever merged into Formik itself isn't up to me, but my fork is available for test purposes here: https://www.npmjs.com/package/@johnrom/formik-v3 It has 1-6 above and Strongly Typed Fields #3152, though notably does not support passing "Extra Props" through the Field component. Due to lack of movement, I've only been focusing on the requirements I need to fill for my own projects. Sandbox is here: https://codesandbox.io/s/serene-napier-4wjxs?file=/src/App.tsx |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days |
There is an alpha of React 18 out now, with full concurrent rendering. An implementation of This is probably a good time to try using |
I'm definitely down for that. I think since in my testing the API could remain the same I would recommend going with this branch first, then falling forward to useMutableSource via some sort of opt-in mechanism. I have no idea what that mechanism would look like without breaking backwards compatibility while fixing the issues people using React@<18 are currently having with Formik. Ideas have been:
|
Created an Umbrella issue for tracking Concurrent Mode items #3236 |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days |
Not stale |
Formik is in major need of a v3. It's been nearly a year since the key improvements to Formik were written and we're still stuck between v2 with it's major issues and 2 "not even alpha, do not use" releases.
It would honestly be better to have a v3 for React 17 now even if it has tearing issues if you use concurrent features in React 18@alpha. And a future v3.1/v4 release with useMutableSource to fix tearing issues and pave the way for React 18. What work (besides approval from @jaredpalmer) is needed to complete #3231? |
From what I can see he doesn't really seem to be involved much here anymore. Might be time to fork the project so it can continue to be useful. |
#3231 is complete as far as I can tell and needs only some secondary eyes on it before release. I'm using it in development already and it's working great. I use both refs3 and types12 here, though idk if I'd release the strongly typed version as it's not feature complete and might need an entire rewrite if typescript adds features supporting an alternate method. Types12 is the PR strongly Typed Formik or something btw |
I'm fine without the strongly typed version. By bad TypeScript types I was actually referring to how v2 has absolutely awful TypeScript mistakes like I'd happily use the alpha, give it some more eyes, and fix anything I find that's in my way. Though I think we're going into production in a couple of months. |
I've been tracking v3 for quite some time. I appreciate your heroic efforts on this @johnrom. I would love to transition from v2 to v3 but the only reservation I have is documentation or examples of the v3 of using Formik. Once I have that understanding then I'll eagerly utilize in production. Is there any current state (or expected date) of documentation or tutorials that can be used for reference? |
@ZipBrandon definitely not using it in production just yet, but hoping for some documentation in the next two weeks. For simple examples using the Formik components (Formik, Form, Fields), nothing has changed. However, using the useFormik hook and innerRef has changed since neither of these will return state. |
Are there any plans for production ready release of a v3? I'd be happy to help with documentation or examples or code. |
Is @jaredpalmer going to merge anything into a new official alpha. Or @johnrom are you interested in forking Formik or having your current fork used in production? I'm willing to contribute. Use the alpha, report and make PRs for any bugs I encounter. Maybe update the documentation a little (though I'm not that capable at writing documentation). etc But I've been waiting for v3 for, *checks git*, 9 months. And I'm now on the verge of needing to either upgrade to formik v3 (in an application currently in the internal usage phase before production); or rewrite our form handling code to use a different library. |
I'm using my fork internally without issue and it's fantastic. I'd love to fork it and create an actual governance model around the fork that I wrote, but I haven't seen much interest in actually using my fork or testing it, and it would be a huge investment of time and resources. It would also be better to get the author's buy-in or ideally create a governance model in-place around the current project. I know Jared has used my fork and said that it works well, but other than that I haven't gotten any feedback -- especially from the React Native community. I really don't know if my Fork works for RN users except with the very specific test environment I used. |
I'm saddened by the stall of v3. I have used formik since 2017. I had been thinking v3 was right around the corner since March and kept hanging onto hope. I really needed it to stabilize re-renders in my app, majorly due to extensive use of helpers in |
I read about V3 and got excited. If I understand correctly, there might not even be a V3? OSS is a hard place to navigate. I'm leaning more and more towards paying a fee to ensure the ongoing investment in the software I use. All OSS maintainers are heroes, but we probably need a better model for this to work in the long run. The reason I'm here is that I'm suspecting that my current form-lib, Final-Form, has lost it's momentum. I'm so far very happy with Final-Form, but I'm worried of what might happen in the future. I'm mostly on React-Native, and 2022 will probably be the year when we get to see the shiny new version with synchronous communication with the Native side. This is exciting, but I fear that this will reak havoc on component libraries. Actively maintained libs will mitigate this risk. As of now there seems to be no incentive for me to rewrite from Final-Form to Formik, since Formik seems to have lost momentum as well. But if V3 would get traction, docs, maintainers, etc, I would gladly give it a serious look. I'm quite deeply invested into Final-Form, so the rewrite wouldn't be a quick-fix. @johnrom I'm cheering for you. You are one of the heroes I wrote about above. I'll follow this thread with interest. |
I feel like at this point, a "proper" fork (maybe "formik-continued" or "formik-enhanced" or something) is the way to go. I suspect theres more interest than it looks if you only consider this thread. But, I think that would only become apparent once it first breaks ground. |
Rewrite projects from FinalForm to Formik is a downgrade in my opinion, I always prefer FinalForm because it's more powerful (format, parse, validate, array), customizable and works truly independently of the platform (Web or Native). Although Formik reinforces that it's 100% compatible with React Native, this is not true, which is why I am here. We can't use I'm also available to collaborate on anything that is necessary, I have good experience with forms and inputs of various types. |
@douglasjunior As I still was worried about the maintenance of FF, so I have migrated evrything to react-hook-form |
I really don't like the semantics of having to It seems unfortunate that @jaredpalmer has abandoned the project. Please do release a fork @johnrom ! |
Formik promised us "forms in React, without the tears", and yet, find us all here crying our hearts out awaiting for @jaredpalmer's comeback. 😭 PD: just joking |
Hi all, please stop tagging people on public repositories, it's rude. Nobody promised anything, liabilities, open source, etc etc. People have lives and sometimes they move on. Just adding some emojis to the PR is a good enough signal of your interest in the PR without being disruptive. Please keep comments related to issues which arise from your testing of the PR I linked to or additional considerations I haven't written in the issue itself. |
Dev Sprint
Full Milestone PR here: #3231
Original PR list for each feature:
PRChoose a state optimization method:useContextSelector v3 #2846, useSubscription Use FormikApi + FormikState Subscriptions #3089PRAdd parse/format to it: v3 #2846PRAdd useFieldArray to it: FieldArray over v3/reducer-refs jawnstreams/formik#22PRMigrate useOptimizedSelector to npm packagePRAdd micro-hooks from: v3 #2846PRSeparate FormikContext and FormikConfigContext: Add missing validationSchema to Formik context #2933 (comment)Once all of the above are merged, I would consider tagging it rc1.
Probably needed for v3.0
Probably backlogged:
connect
#3110Administrative:
The text was updated successfully, but these errors were encountered: