nuxt-modules / algolia

🔎 Algolia module for Nuxt
https://algolia.nuxtjs.org/
MIT License
191 stars 35 forks source link

Better documentation for SSR #164

Closed jpengelbrecht closed 11 months ago

jpengelbrecht commented 1 year ago

sorry if this is the wrong place to add this.
I am reading the docs and i am finding the SSR. But the documentation for client side and SSR is confusing as hell. Client side is clear enough, but the SSR starts borrowing steps from the client side explanation and at some point its not clear what is needed in each step.

i think this would be a lot easier if there was just a full SSR example. maybe even get a stackblitz working with it.

Baroshem commented 1 year ago

Hey,

Thanks for the feedback. I am aware that it may not be easy to understand it as the whole process of enabling Vue Instantsearch on SSR is not easy :(

Take a look at the official docs -> https://www.algolia.com/doc/guides/building-search-ui/going-further/server-side-rendering/vue/

It is because this library is mainly client side. It is possible to get it working in SSR but it is not easy as you can see from both Algolia and the module docs.

I am completely into the idea of Stackblitz. I think this would help a lot (and also maybe we would find ideas to improve the docs as well).

If anyone is up for creating such a Stackblitz, please let me know. If not, I will do it in the upcoming weeks :)

Baroshem commented 1 year ago

Maybe @camaech you would be interested in creating a Stackblitz link? :)

plexus77 commented 1 year ago

Having a lot of trouble getting SSR to work properly using routing or intialstate, also the render function doesn't seem to add the widgets properly to the returned state. A fully fledged example would be great

monkemedia commented 1 year ago

Has anyone managed to get this to work?

plexus77 commented 1 year ago

Yeah I did, got it working with custom routing as well and a component render function… discovered that i needed virtual widgets to get the initial query working properly as the components present in the render function weren’t enough to set the initial query. I can try to cobble together a minimal example next week sometime if that helps

Baroshem commented 1 year ago

@plexus77 that would be really awesome! Maybe you could also create a Stackblitz example? That would be more than amazing :)

monkemedia commented 1 year ago

That would be very much appreciated. Thanks @plexus77

plexus77 commented 12 months ago

Here you go guys :)

https://stackblitz.com/github/plexus77/nuxt-3-algolia-ssr?file=README.md

plexus77 commented 12 months ago

We discovered while creating this example that it seems to render a html string on the server using the single file vue template rather than the render function in the ssr component.

I think the render function is needed, though it does feel like there should be a better solution available for this

Baroshem commented 11 months ago

Thank you so much @plexus77 ! I will add it to the documentation :)