Replies: 3 comments 4 replies
-
Agree. With all this. useMutableSource may be the only way out. We need some kind of benchmark so we can develop against it. Perhaps cypress or puppeteer can help there. Some more context on my progress...
|
Beta Was this translation helpful? Give feedback.
-
I haven't been using formik for a long time - didn't miss any features yet.
Was looking a bit in how-to measure react performance in a ci and stepped over react-hook-form vs formik which i think is a kinda unfair comparison, but symbolizes a bit of the problems I initially had with formik. You have to put quite some effort into optimizing things as they aren't by default. Material-ui is benchmarking it's styling solution. Not sure if that might suite as inspiration? - i guess it's a lot harder to measure performance implications of state updates than simply measuring the mount time. |
Beta Was this translation helpful? Give feedback.
-
2020 Summer Update: Going to pause the existing v3 rewrite and replace with this Roadmap:
|
Beta Was this translation helpful? Give feedback.
-
Let this serve as the first real test of Github Discussions as pertains to Formik. Continuing off of the PR, I think we should create an RFC for v3 that contains an API which is agreed upon (by who?) in some way before creating, or based upon implementations in, MVP PRs like the aforementioned v3 MVP PR.
I've been seeing a lot of issues lately where users are left without options (or using sub-par options) when pursuing certain functionality, and I think a part of continuing to support such a large community will be making sure the v3 API can support these various use cases (as well as what we currently support). I found that many use cases would be supported by allowing the Reducer that Formik uses to manage state be replaced or enhanced by a user, and I will probably try and create a PR based around this concept.
The overall first priority of v3, however, will be performance. It seems that React Context has put us in the same situation as many who have come before us -- performance has tanked since implementing it because it is very hard to memoize the rendering of components based on the slice of context that they require. We are basically Redux v6 right now, and it is clear that users have noticed.
In the MVP PR, there was an attempt to circumvent this performance issue by managing state at the Field level. I think we need to benchmark whether this actually improves performance overall, or if it trades context performance for making it prohibitively expensive to manage state at the form level. I don't have an answer to this, but I'd guess that managing dependent field values would be super expensive in the v3 MVP, which for my use cases would be a huge step back.
I think we need to execute this initial performance trade-off just right in order to remain competitive with other form libraries. I was hoping we'd have some kind of Context Selector API in React by now which would solve this problem. There are hints of some experimentation with
useMutableSource
and "another system" which sometime in the future may allow us to use performant Context-like state at the Form level. I think there is a case for managing more state at the Field level. But I think the core of Formik is still Form-level, and users are going to want configuration and performance optimized at that level and the Field level. Therefore, I think this RFC should outline which state is managed at the Field level and which is at the Form Level.I think the RFC should also outline and provide the necessary escape hatches to get state bound to a specific render vs. future state accessible from callbacks, events and effects. I feel like the current API is a bit muddy in this area (or maybe just the documentation is?).
For an RFC, I'd like to gather some of the impossible or non-ideal workarounds we have currently in the issues and gather them here for discussion for inclusion into the RFC, and create a set of requirements that would form the basis for Formik v3 RFC which includes support for those scenarios, a very explicit and concise API definition, and a baseline of Form- and Field-level performance we'd want to achieve before shipping (how can we quantify that?).
Let me know what you think about this plan of attack!
RFC Requirements
Impossible features / non-ideal workarounds
Beta Was this translation helpful? Give feedback.
All reactions