Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(index): only set listeners on init once #4634

Merged
merged 2 commits into from
Jan 26, 2021
Merged

fix(index): only set listeners on init once #4634

merged 2 commits into from
Jan 26, 2021

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jan 25, 2021

Summary

Without this, if init is called multiple times (like in Vue InstantSearch), multiple event listeners are attached, as well as the helper being recreated. This causes the references from the first init call to no longer being correct later in the instance.

Since we save the references in the very first call of getWidgetRenderState in most widgets (if (!refine) refine =), the helper reference needs to stay stable.

Result

This fixes algolia/vue-instantsearch#911 by avoiding to have a different helper instance when init gets called multiple times.

Without this, if init is called multiple times, multiple event listeners are attached, as well as the helper beign recreated.

This fixes algolia/vue-instantsearch#911 by avoiding to have a different helper instance when init gets called multiple times
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 25, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4ed1365:

Sandbox Source
InstantSearch.js Configuration

@Haroenv Haroenv marked this pull request as ready for review January 26, 2021 11:05
@Haroenv Haroenv merged commit 730b49d into master Jan 26, 2021
@Haroenv Haroenv deleted the poc/gwrs-fix-2 branch January 26, 2021 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nuxt Routing issue when I follow vue-instantsearch document?
2 participants