Filter null comments coming into moderation queues to prevent white screening (#2509)

Wyatt and I are not sure why comments are coming back null, but this should
keep the moderation area from blanking out when it errors handling nulled out
comments crashing the queue.

FIXME tag added with Wyatt/Nick as this is only a patching fix and does
not resolve the underlying issue.
This commit is contained in:
Nick Funk
2019-08-28 14:21:35 -04:00
committed by Kim Gardner
parent 7e7ce9fbd0
commit fc039f8186
@@ -71,26 +71,29 @@ const Queue: FunctionComponent<Props> = ({
</Flex>
)}
<TransitionGroup component={null} appear={false} enter={false} exit>
{comments.map(c => (
<CSSTransition
key={c.id}
timeout={400}
classNames={{
exit: styles.exitTransition,
exitActive: styles.exitTransitionActive,
exitDone: styles.exitTransitionDone,
}}
>
<ModerateCardContainer
settings={settings}
viewer={viewer}
comment={c}
danglingLogic={danglingLogic}
showStoryInfo={Boolean(allStories)}
onUsernameClicked={onShowUserDrawer}
/>
</CSSTransition>
))}
{comments
// FIXME (Nick/Wyatt): Investigate why comments are coming back null
.filter(c => Boolean(c))
.map(c => (
<CSSTransition
key={c.id}
timeout={400}
classNames={{
exit: styles.exitTransition,
exitActive: styles.exitTransitionActive,
exitDone: styles.exitTransitionDone,
}}
>
<ModerateCardContainer
settings={settings}
viewer={viewer}
comment={c}
danglingLogic={danglingLogic}
showStoryInfo={Boolean(allStories)}
onUsernameClicked={onShowUserDrawer}
/>
</CSSTransition>
))}
</TransitionGroup>
{hasMore && (
<Flex justifyContent="center">