vue-instantsearch icon indicating copy to clipboard operation
vue-instantsearch copied to clipboard

Nuxt SSR broken

Open sjahns opened this issue 3 years ago • 4 comments

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

sjahns avatar Mar 28 '22 07:03 sjahns

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.

ArcoMul avatar Mar 28 '22 07:03 ArcoMul

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?

sjahns avatar Mar 30 '22 06:03 sjahns

@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.

Haroenv avatar Mar 30 '22 08:03 Haroenv

@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

sjahns avatar Mar 30 '22 09:03 sjahns