fix duplicate key issue when rendering search highlights
This commit is contained in:
		
							parent
							
								
									0daff7a01f
								
							
						
					
					
						commit
						a19b392787
					
				| @ -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> | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user