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 SSR broken #1118

Closed sjahns closed 1 year ago

sjahns commented 2 years ago

Bug 🐞

What is the current behavior?

Nuxt SSR is broken With 4.3.3 the problem is described here https://github.com/algolia/vue-instantsearch/pull/1117 With 3.9.0 I get "Cannot read property 'propsData' of undefined". The provided Sandbox shows this case. npm run dev and go to http://localhost:3000/search If I remove the serverPrefetch() it works without SSR

Make a sandbox with the current behavior

https://github.com/sjahns/test-vue-instant-search

I followed the documentation in https://www.algolia.com/doc/guides/building-search-ui/going-further/server-side-rendering/vue/#with-nuxt only difference is the version I installed npm install vue-instantsearch@^3.9.0 algoliasearch

What is the expected behavior?

Nuxt SSR should work

Does this happen only in specific situations?

What is the proposed solution?

What is the version you are using?

3.9.0 and 4.3.3

ArcoMul commented 2 years ago

I have also seen this error in the latest version (4.3.3) in 4.3.2 this does not occur. I had this happening in a setup which is not using Nuxt, but does use SSR.

sjahns commented 2 years ago

ok so after fiddling around with it...

@ArcoMul is correct. v4.3.2 works fine, so you can use that version until the fixed version is released

concerning v3.9.0: the findResultsState() takes only the component as parameter so findResultsState(this)and not findResultsState({component: this,renderToString}). That change came with v4.

So I guess then my question is: Is there a way to see the v3 documentation?

Haroenv commented 2 years ago

@sjahns, only the latest version is documented, which indeed means you have to look at the migration guide to see these issues. We are investigating what system could keep previous versions available.

For the actual bug report I have looked and did not yet manage to pinpoint what about the commit could be relevant about propsData, as it doesn't touch it.

sjahns commented 2 years ago

@Haroenv the actual bug is "I did it wrong because I tried to use it like v4, which is wrong because of the breaking changes."

v4.3.2 works v3.9.0 works after I changed the findResultsState() call

I think that means this can be closed because the v4.3.3 issue exists in https://github.com/algolia/vue-instantsearch/pull/1117 and v3.9.0 works if you use it correctly

anything concerning the documentation would be a whole different issue