Fix map error

pull/2092/head
Jérémy Rialland 2022-04-06 11:03:49 +02:00 committed by Johan Girod
parent 5e1c1a2aa3
commit 90162cc2ce
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import { FabriqueSocialEntreprise } from '@/api/fabrique-social'
import { Spacing } from '@/design-system/layout'
import { Strong } from '@/design-system/typography'
import { H4 } from '@/design-system/typography/heading'
import { useMemo } from 'react'
import { Fragment, useMemo } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import styled from 'styled-components'
@ -63,14 +63,14 @@ function highlightLabelToJSX(highlightLabel: string) {
const highlightRE = /(.*?)<b><u>(.+?)<\/u><\/b>/gm
let parsedLength = 0
const result = []
let matches
let matches: RegExpExecArray | null = null
while ((matches = highlightRE.exec(highlightLabel)) !== null) {
parsedLength += matches[0].length
result.push(
<>
<Fragment key={matches[2]}>
{matches[1]}
<Highlight>{matches[2]}</Highlight>
</>
</Fragment>
)
}
result.push(highlightLabel.slice(parsedLength))