-
Notifications
You must be signed in to change notification settings - Fork 15
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
Bug/Remove bubble when no reviews #807
Conversation
@@ -147,12 +147,12 @@ export default function SideNavigation({ | |||
<ListItemIcon> | |||
{!drawerOpen ? ( | |||
<Tooltip title='Review' arrow placement='right'> | |||
<Badge badgeContent={reviewCount} color='secondary'> | |||
<Badge badgeContent={reviewCount} color='secondary' invisible={reviewCount == 0}> |
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.
Always use strict equality ===
when comparing values.
@@ -91,7 +91,7 @@ export default function SideNavigation({ | |||
}, []) | |||
|
|||
async function fetchReviewCount() { | |||
setReviewCount((await getReviewCount()).headers.get('x-count') as unknown as number) | |||
setReviewCount((await getReviewCount()).headers.get('x-count') as string) |
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.
I think it would be cleaner to parse it as a number here. E.g:
setReviewCount(parseInt((await getReviewCount()).headers.get('x-count')))
Then reviewCount can remain a number, and you can compare it as a number
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.
Is it be preferable to raise an error on a null response or set the value to 0?
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.
No description provided.