mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 19:50:37 +03:00
Remove duplicated call to split
This commit is contained in:
parent
07f815edfd
commit
7eb99d0b8d
@ -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) => (
|
||||
<span key={record.id + '-comment-' + idx}>
|
||||
<span dangerouslySetInnerHTML={{ __html: line }} />
|
||||
<br />
|
||||
</span>
|
||||
))
|
||||
}, [record.comment, record.id])
|
||||
}, [lines, record.id])
|
||||
|
||||
const handleExpandClick = useCallback(() => {
|
||||
setExpanded(!expanded)
|
||||
}, [expanded, setExpanded])
|
||||
|
||||
const numLines = record.comment.split('\n').length
|
||||
|
||||
return (
|
||||
<Collapse
|
||||
collapsedHeight={'1.5em'}
|
||||
@ -106,7 +105,7 @@ const AlbumComment = ({ record }) => {
|
||||
timeout={'auto'}
|
||||
className={clsx(
|
||||
classes.commentBlock,
|
||||
numLines > 1 && classes.pointerCursor
|
||||
lines.length > 1 && classes.pointerCursor
|
||||
)}
|
||||
>
|
||||
<Typography variant={'body1'} onClick={handleExpandClick}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user