Skip to content

Commit 529adff

Browse files
authored
Highlight tag flicker fix (#889)
1 parent cbc98c1 commit 529adff

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

resources/js/components/Search/InstantSearchMixin.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ export default {
3535
},
3636
3737
async getInstantSearchClientConfig() {
38-
return {}
38+
return {
39+
hooks: {
40+
beforeSearch: async (searchRequests) => {
41+
return searchRequests.map((sr) => {
42+
sr.request.params.highlightPreTag = '<mark>'
43+
sr.request.params.highlightPostTag = '</mark>'
44+
return sr
45+
})
46+
},
47+
},
48+
}
3949
},
4050
4151
async getSearchSettings() {

resources/views/layouts/partials/header/autocomplete/search-suggestions.blade.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
:query="currentRefinement || ' '"
99
:hits-per-page.camel="{{ Arr::get($fields, 'size', config('rapidez.frontend.autocomplete.size', 3)) }}"
1010
filters="display_in_terms:1"
11-
:highlight-pre-tag.camel="'__ais-highlight__'"
12-
:highlight-post-tag.camel="'__/ais-highlight__'"
1311
/>
1412
<ais-hits v-slot="{ items }">
1513
<div v-if="items && items.length" v-bind:class="{ 'border-b': currentRefinement }" class="py-2.5">

0 commit comments

Comments
 (0)