algolia / vue-instantsearch

👀 Algolia components for building search UIs with Vue.js
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/vue
MIT License
854 stars 157 forks source link

Nuxt error using serverPrefetch with findResultsState #1143

Closed readio closed 2 years ago

readio commented 2 years ago

Bug 🐞

What is the current behavior?

When using serverPrefetch with findResultsState I get the following error: Cannot set property $nuxt of [object Object] which has only a getter

Make a sandbox with the current behavior

Template: https://codesandbox.io/s/github/algolia/create-instantsearch-app/tree/templates/vue-instantsearch

What is the expected behavior?

Search page should render with Alogolia components

Does this happen only in specific situations?

What is the proposed solution?

What is the version you are using?

algoliasearch 4.14.2 vue-instantsearch 4.4.2

Always try the latest one before opening an issue.

Haroenv commented 2 years ago

Hi, I've made a draft pull request in the past that I think should fix this, but never got a full reproduction to confirm it does. If you use the deploy preview of codesandbox of this PR: https://github.com/algolia/vue-instantsearch/pull/1117 in your project, and it solves the problem, that would be very helpful, thanks!

readio commented 2 years ago

Hi @Haroenv I can confirm that fix applied to src/util/createServerRootMixin.js fixes the error.

Haroenv commented 2 years ago

Perfect, I'll close this issue now then, as it will be released soon