Skip to content

Conversation

@bsonntag
Copy link
Contributor

@bsonntag bsonntag commented Mar 28, 2022

WORK IN PROGRESS

This PR adds a rewrite of the module that aims to improve performance of forms.

In this implementation, instead of storing the form state in a useReducer, I'm storing it in a useRef. Each useField then uses use-subscription to subscribe to changes to a field's state. With this, only the fields that need to be updated will be re-rendered, instead of the whole form.

I tried to make the API change of the module as small as possible, so that this rewrite can be dropped-in in any application that is using @seegno/react-forms without much difficulty.

I also took the opportunity of the rewrite to change the module to TypeScript.

@bsonntag bsonntag force-pushed the feature/rewrite-with-subscriptions branch from ca4111e to de39e39 Compare March 28, 2022 12:47
@bsonntag bsonntag force-pushed the feature/rewrite-with-subscriptions branch from de39e39 to e0f22c8 Compare March 28, 2022 12:51
},
"main": "dist/index.js",
"scripts": {
"bundle": "rm -rf dist && babel src --out-dir dist",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to parcel right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Parcel is only used to bundle the example application. The module is still bundled using Babel.

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.

3 participants