File tree 2 files changed +13
-11
lines changed
packages/docsearch-react/src/utils 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ function App() {
9
9
< div >
10
10
< h1 > DocSearch v3 - React</ h1 >
11
11
< DocSearch
12
- indexName = "docsearch "
13
- appId = "R2IYF7ETH7 "
14
- apiKey = "599cec31baffa4868cae4e79f180729b "
12
+ indexName = "vuejs "
13
+ appId = "ML0LEBN7FQ "
14
+ apiKey = "21cf9df0734770a2448a9da64a700c22 "
15
15
insights
16
16
/>
17
17
</ div >
Original file line number Diff line number Diff line change @@ -12,13 +12,15 @@ export function removeHighlightTags(
12
12
return hit . hierarchy . lvl0 ;
13
13
}
14
14
15
- const { value } =
16
- ( internalDocSearchHit . __docsearch_parent
17
- ? internalDocSearchHit . __docsearch_parent ?. _highlightResult ?. hierarchy
18
- ?. lvl0
19
- : hit . _highlightResult ?. hierarchy ?. lvl0 ) || { } ;
15
+ const lvl0 = internalDocSearchHit . __docsearch_parent
16
+ ? internalDocSearchHit . __docsearch_parent ?. _highlightResult ?. hierarchy ?. lvl0
17
+ : hit . _highlightResult ?. hierarchy ?. lvl0 ;
20
18
21
- return value && regexHasHighlightTags . test ( value )
22
- ? value . replace ( regexHighlightTags , '' )
23
- : value ;
19
+ if ( ! lvl0 ) {
20
+ return hit . hierarchy . lvl0 ;
21
+ }
22
+
23
+ return lvl0 . value && regexHasHighlightTags . test ( lvl0 . value )
24
+ ? lvl0 . value . replace ( regexHighlightTags , '' )
25
+ : lvl0 . value ;
24
26
}
You can’t perform that action at this time.
0 commit comments