Commit 496af7f8 authored by Kyle Keating's avatar Kyle Keating

Prevent 0 flag count from rendering in DOM

Preact exhibits funny behavior for inline conditionals that don’t resolve to an actual boolean value. When the flagCount variable is 0 it renders the conditional statement directly in the dom. Casting to a boolean prevents this.
parent d8efffcf
...@@ -75,7 +75,7 @@ function ModerationBanner({ annotation, api, flash }) { ...@@ -75,7 +75,7 @@ function ModerationBanner({ annotation, api, flash }) {
} }
return ( return (
<div className={bannerClasses}> <div className={bannerClasses}>
{flagCount && !annotation.hidden && ( {Boolean(flagCount) && !annotation.hidden && (
<span>Flagged for review x{flagCount}</span> <span>Flagged for review x{flagCount}</span>
)} )}
{annotation.hidden && ( {annotation.hidden && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment