Skip to content

feat(replyform): Avoid flash of enabled Post button#565

Merged
mergify[bot] merged 2 commits intobox:masterfrom
ConradJChan:reply-form-disabled
Aug 28, 2020
Merged

feat(replyform): Avoid flash of enabled Post button#565
mergify[bot] merged 2 commits intobox:masterfrom
ConradJChan:reply-form-disabled

Conversation

@ConradJChan
Copy link
Contributor

https://formik.org/docs/api/withFormik#mappropstoerrors-props-props--formikerrorsvalues

Adding the mapPropsToErrors with an initial error allows the Post button to render disabled on the initial mount before the formik validate method kicks in.

@ConradJChan ConradJChan requested a review from a team as a code owner August 28, 2020 04:17
@mingzexiao6
Copy link
Contributor

Is there any way to add a test for the change?

@ConradJChan
Copy link
Contributor Author

Yes? I tried but it also ends up throwing a console error because validateOnMount: true causes a re-render and results in
console.error node_modules/react-dom/cjs/react-dom.development.js:88 Warning: An update to Formik inside a test was not wrapped in act(...). When testing, code that causes React state updates should be wrapped into act(...):

Which is not great. It's a simple change, I'm thinking we skip the test

@mergify mergify bot merged commit 84dd440 into box:master Aug 28, 2020
@ConradJChan ConradJChan deleted the reply-form-disabled branch August 28, 2020 17:29
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