Skip to content

Commit

Permalink
potential fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Apr 27, 2020
1 parent 377d5a3 commit 56f68c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/InstantSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ class InstantSearch extends EventEmitter {
public _mainHelperSearch?: AlgoliaSearchHelper['search'];
public middleware: MiddlewareDefinition[] = [];

// this is set on the instance by SSR implementations. The goal is to prevent
// e.g. change events taking effect while doing a prerender.
public __isServerRendering?: boolean;

public constructor(options: InstantSearchOptions) {
super();

Expand Down
5 changes: 4 additions & 1 deletion src/widgets/index/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ const index = (props: IndexProps): Index => {
// configuration of the widget is pushed in the URL. That's what we want to avoid.
// https://github.com/algolia/instantsearch.js/pull/994/commits/4a672ae3fd78809e213de0368549ef12e9dc9454
helper.on('change', ({ state }) => {
if (!instantSearchInstance.started) {
if (
instantSearchInstance.__isServerRendering &&
!instantSearchInstance.started
) {
return;
}

Expand Down

0 comments on commit 56f68c9

Please sign in to comment.