question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi, fellow contributors. I feel the time has come to start considering a new major version release so that we can introduce some breaking changes and deal with issues that burden formsy from the old times when things were handled with mixins. Let’s post ideas for 2.0.0 here as an “umbrella issue” so that we can start working on them and hopefully release a beta at some point. Also feel free to tell me that I’m dumb and we don’t need a new major version 😉

For the starters, we have #48 and #50, both reviewed and awaiting merge, both with introducing breaking but much needed changes.

To start with ideas, one that I had is streamlining withFormsy. Currently, for each custom form element, we need to make a new component that renders the base one, an error message and copies the value to Formsy HOC’s state. This is pretty simple but there’s a lot of code, a lot of boilerplate to just copy-paste around. I’d like to improve this by making withFormsy work more like Redux’s connect. Something like:

import { withFormsy } from 'formsy-react';
import React from 'react';
import MyInput from './some/path/MyInput';

const mapValue = event => {
  return event.currentTarget.value;
};

const renderWrapper = (Component, props) => (
  <div>
    <Component {...props} />
    <span>{this.props.errorMessage}</span>
  </div>
);

export default withFormsy(MyInput, mapValue, renderWrapper);

We could also make mapValue and renderWrapper from this example the defaults, so it would simply look like

import { withFormsy } from 'formsy-react';
import React from 'react';
import MyInput from './some/path/MyInput';

export default withFormsy(MyInput);

and uses could still supply their own mapValue and renderWrapper for cases that differ from defaults. Should probably also allow onChange prop name override for base components that deviate from the standard.

This has multiple benefits over the current HOC:

  1. Much less verbose, especially for simple cases.
  2. Easier to just drop into whatever file is using Formsy rather than writing a separate file to wrap each custom component.
  3. Looks cool af. I mean, that’s a render prop as a HOC argument… a render argument?

Another idea would be performance issues. Aside from optimizing existing code if feasible, I’d also like to look into the possibility of marking elements as “isolated”, meaning they don’t affect rendering and validation of the form and other elements. With elements like these, we could opt to not rerender the form when they change. It would probably have to be calculated at runtime and not left to user to specify as a prop.

Any of this make sense to you guys or am I just rambling?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MilosRasiccommented, Feb 14, 2018

I wouldn’t do it on master. If we find a bug that could be fixed in 1.x it would become impossible if master is bumped to 2.0. How about a 2.0 branch which we can merge into master once it’s good enough for release?

1reaction
Kaishiyokucommented, Feb 14, 2018

Your suggestions make sense to me and I would appreciate it to seeing a 2.0.0 release in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semantic Versioning 2.0.0 | Semantic Versioning
Semantic Versioning 2.0.0. Summary. Given a version number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes ...
Read more >
R-2.0.0 for Windows
R-2.0.0 for Windows. This directory contains a binary distribution of R-2.0.0 to run on Windows 95, 98, ME, NT4.0, 2000 and XP on...
Read more >
2.0.0 - Homebrew
Today I'd like to announce Homebrew 2.0.0. The most significant changes since 1.9.0 are official support for Linux and Windows 10 (with ...
Read more >
readr 2.0.0 - Tidyverse
readr 2.0.0 is a major release of readr and introduces a new 2nd edition parsing and writing engine implemented via the vroom package....
Read more >
Overview - Spark 2.0.0 Documentation - Apache Spark
Apache Spark is a fast and general-purpose cluster computing system. It provides high-level APIs in Java, Scala, Python and R, and an optimized...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found