From 7eb99d0b8d2913e0452c0de9bd89afee4fc3d1b7 Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 15 Feb 2021 14:18:57 -0500 Subject: [PATCH] Remove duplicated call to `split` --- ui/src/album/AlbumDetails.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/src/album/AlbumDetails.js b/ui/src/album/AlbumDetails.js index 724383b56..00671062e 100644 --- a/ui/src/album/AlbumDetails.js +++ b/ui/src/album/AlbumDetails.js @@ -84,21 +84,20 @@ const AlbumComment = ({ record }) => { const classes = useStyles() const [expanded, setExpanded] = React.useState(false) + const lines = record.comment.split('\n') const formatted = useMemo(() => { - return record.comment.split('\n').map((line, idx) => ( + return lines.map((line, idx) => (
)) - }, [record.comment, record.id]) + }, [lines, record.id]) const handleExpandClick = useCallback(() => { setExpanded(!expanded) }, [expanded, setExpanded]) - const numLines = record.comment.split('\n').length - return ( { timeout={'auto'} className={clsx( classes.commentBlock, - numLines > 1 && classes.pointerCursor + lines.length > 1 && classes.pointerCursor )} >