Getting Started

Welcome to Nuxt Swiftsearch documentation

What happened with Vue Instantsearch, and why another module?

Instantsearch provides a set of very convenient tools for building your search UI with algolia in a fast way and with great DX. So why building a nuxt module? Well, vue-instantsearch approach for managing state does not play well with the SSR approach, basically this is what happens:

  • Components are inserted inside a slot (the AisInstantSearchComponent)
  • At the setup (or created) step in the Vue lifecycle they subscribe themselves to the Instantsearch instance
  • The instantsearch instance, when all components have been subscribed, makes a request
  • Components gets hydrated

This provides the best DX for the end user, but there's a catch: in SSR the components can't be hydrated because everything gets done in a single tick.

This package re-implements Vue Instantsearch components so that they read and write to a centralized instance, that gets injected with widgets beforehand so that Nuxt can handle everything in the same tick.


Copyright © 2023