Skip to content

Commit 888f935

Browse files
authored
Fix error if formateedHit[key] is null (#25)
1 parent 7679130 commit 888f935

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function instantMeiliSearch(hostUrl, apiKey, options = {}) {
2727
// formattedHit is the `_formatted` object returned by MeiliSearch.
2828
// It contains all the highlighted attributes
2929
return Object.keys(formattedHit).reduce((result, key) => {
30-
let newHighlightString = formattedHit[key]
30+
let newHighlightString = formattedHit[key] || ''
3131
// If the value of the attribute is a string,
3232
// the highlight is applied by MeiliSearch (<em> tags)
3333
// and we replace the <em> by the expected tag for InstantSearch

0 commit comments

Comments
 (0)