-
Notifications
You must be signed in to change notification settings - Fork 888
fix: UX - Error logs in development from Empty state component #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -0,0 +1,22 @@ | |||
// Helper utility to fail jest tests if a console.error is logged | |||
// Pulled from this blog post: | |||
// https://www.benmvp.com/blog/catch-warnings-jest-tests/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!
Codecov Report
@@ Coverage Diff @@
## main #466 +/- ##
==========================================
- Coverage 68.20% 68.17% -0.04%
==========================================
Files 160 160
Lines 9260 9259 -1
Branches 79 79
==========================================
- Hits 6316 6312 -4
- Misses 2326 2329 +3
Partials 618 618
Continue to review full report at Codecov.
|
Fixes #452
When the empty state is rendered with a non-textual element (which it turns out all our current empty states are, because they have a
<button />
component as a call to action), this noisy error log was showing up in theconsole
:The issue was that the
description
prop could either be astring
or an actualReact
component, but was always rendered as a child of a<Typography />
component. The<Typography>
component internally renders as a<p>
, which is not valid to nest<div>
s inside.The fix is to not nest inside a
<Typography />
block, but an actual<div />
.