fix duplicate key issue when rendering search highlights

This commit is contained in:
keyan 2023-10-15 16:13:54 -05:00
parent 0daff7a01f
commit a19b392787
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ import AdIcon from '../svgs/advertisement-fill.svg'
export function SearchTitle ({ title }) {
return reactStringReplace(title, /\*\*\*([^*]+)\*\*\*/g, (match, i) => {
return <mark key={`strong-${match}`}>{match}</mark>
return <mark key={`strong-${match}-${i}`}>{match}</mark>
})
}

View File

@ -20,7 +20,7 @@ export function SearchText ({ text }) {
<div className={styles.text}>
<p className={styles.p}>
{reactStringReplace(text, /\*\*\*([^*]+)\*\*\*/g, (match, i) => {
return <mark key={`strong-${match}`}>{match}</mark>
return <mark key={`strong-${match}-${i}`}>{match}</mark>
})}
</p>
</div>