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(mainHelper): allow a mainHelper to be set before start #4790

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jun 23, 2021

Summary

In Vue InstantSearch server side rendering, we set a mainHelper https://github.com/algolia/vue-instantsearch/blob/118e0a39b8a047930520220da757ff0175cec12d/src/util/createServerRootMixin.js#L234-L235 before the instance is started.

This worked fine with existing fixes done, except for in routing, because every place that changes the state uses helper from the index, which is derived of the helper that's created before start. Routing and middleware however uses the helper which gets created in start, and thus don't trigger a search on the helper that actually searches.

To avoid these issues, we prevent recreation of the main helper if it's already set (by Vue InstantSearch for example). Whenever we will add the proper API for server side rendering in InstantSearch, we can rethink this part and probably remove it on a major.

Result

mainHelper doesn't get recreated if there's already one present

@Haroenv Haroenv requested a review from eunjae-lee June 23, 2021 11:15
@codesandbox-ci
Copy link

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 90db350:

Sandbox Source
InstantSearch.js Configuration

@Haroenv Haroenv requested review from a team and tkrugg and removed request for a team June 23, 2021 11:26
Copy link
Contributor

@eunjae-lee eunjae-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🙌

@Haroenv Haroenv merged commit e8329ae into master Jun 23, 2021
@Haroenv Haroenv deleted the fix/helper-start branch June 23, 2021 12:18
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.

2 participants