Skip to content

Commit

Permalink
docs(integrate-with-nuxt): add missing method call (algolia#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrutjes authored and Haroenv committed Feb 7, 2018
1 parent 79432b9 commit 40c9406
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/src/advanced/integrate-with-nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ searchStore.indexName = 'bestbuy'
export default {
async asyncData () {
searchStore.start()
searchStore.refresh()
await searchStore.waitUntilInSync()
return { serializedSearchStore: searchStore.serialize() }
Expand All @@ -148,7 +149,7 @@ First thing to notice is that you now [manually pass down the search store](gett
This allows you to have a better control over the lifecycle of the search.

In the `asyncData` method, multiple things happen:
1. you first manually start the store which will launch the first query to Algolia `searchStore.start()`
1. you first manually start & refresh the store which will launch the first query to Algolia `searchStore.start()` && `searchStore.refresh()`
2. you then wait for the query to be done so that you get all the results in the store with `store.waitUntilInSync()` method
3. you return the serialized version of the store so that it can be passed to the frontend `return { serializedSearchStore: searchStore.serialize() }`

Expand Down

0 comments on commit 40c9406

Please sign in to comment.