We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28b2cb1 commit b788c33Copy full SHA for b788c33
1 file changed
packages/docsearch-react/src/Snippet.tsx
@@ -15,10 +15,11 @@ export function Snippet<TItem extends StoredDocSearchHit>({
15
tagName = 'span',
16
...rest
17
}: SnippetProps<TItem>) {
18
- let displayValue = hit._highlightResult[attribute]?.value || hit[attribute];
+ let displayValue =
19
+ hit?._highlightResult?.[attribute]?.value || hit?.[attribute];
20
- if (hit._snippetResult?.[attribute]?.value) {
21
- let snippetValue = hit._snippetResult[attribute]?.value;
+ if (hit?._snippetResult?.[attribute]?.value) {
22
+ let snippetValue = hit?._snippetResult?.[attribute]?.value;
23
if (displayValue.substring(0, 20) !== snippetValue.substring(0, 20)) {
24
snippetValue = `… ${snippetValue}`;
25
}
0 commit comments