Skip to content

Remove formik Field components from UI layer - #1064

Merged
just-be-dev merged 2 commits into
mainfrom
get-outta-here
Jul 21, 2022
Merged

just-be-dev merged 2 commits into
mainfrom
get-outta-here

Conversation

@just-be-dev

Copy link
Copy Markdown
Contributor

When we first started integrating Formik into the console we really didn't have much of a separation between the UI of a form element and its actual logical behavior. Given that, we added the Field component in our form UI components. This has a few downsides:

  1. It necessitates that the UI layer includes formik as a dependency if we ever ship it separately
  2. It requires that any UI form component only be rendered inside the context of a formik form

This tight coupling has already caused a few minor issues. I'm working on richer table selection behavior to address #1060 and I ran into it but it's not the first time I've ran across it.

Also, we've got #804 where we're actively considering migrating away from Formik. This would be the first required step either way.

@just-be-dev
just-be-dev requested a review from david-crespo July 21, 2022 17:20
@vercel

vercel Bot commented Jul 21, 2022 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
console-ui-storybook ✅ Ready (Inspect) Visit Preview Jul 21, 2022 at 5:45PM (UTC)

Comment on lines +18 to +19
/** HTML type attribute, defaults to text */
type?: string

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made this configurable so we could pass down number, etc

@david-crespo david-crespo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome! I did a search for formik in libs/ui and found the FormikDecorator, which we were using to make Storybook stories not break due to missing Formik context. I think that can go too, taking this even further negative LoC. Love it!

This branch was successfully deployed

1 active deployment
Preview — c4ebf517 Deployed Jul 21, 2022 by vercel[bot]
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.

2 participants