Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(highlight): wrong parsing between client and server (#183)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

We remove the timestamp present in our highlight preTag and postTag. If you were using regex to parse the
highlighting results then you'll need to adapt it as now it's only "ais-highlight".
  • Loading branch information
mthuret authored Jul 25, 2017
1 parent bb12c29 commit 2daae70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ReactDom from 'react-dom/server';
import { getIndex, hasMultipleIndex } from './indexUtils';
import { isEmpty } from 'lodash';
import cis from './createInstantSearch';
import highlightTags from './highlightTags.js';

const createInstantSearch = function(algoliasearch) {
const InstantSearch = cis(algoliasearch, {
Expand Down Expand Up @@ -48,7 +49,7 @@ const createInstantSearch = function(algoliasearch) {
searchParameter.props,
searchParameter.searchState
),
new SearchParameters({ index: indexName })
new SearchParameters({ index: indexName, ...highlightTags })
);

const mergedSearchParameters = searchParameters
Expand Down
6 changes: 2 additions & 4 deletions packages/react-instantsearch/src/core/highlightTags.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const timestamp = Date.now().toString();

export default {
highlightPreTag: `<ais-highlight-${timestamp}>`,
highlightPostTag: `</ais-highlight-${timestamp}>`,
highlightPreTag: `<ais-highlight>`,
highlightPostTag: `</ais-highlight>`,
};

0 comments on commit 2daae70

Please sign in to comment.