From 2713ff6d49650bf80d52df6c6c9779c83e99fa68 Mon Sep 17 00:00:00 2001 From: Aymeric Giraudet Date: Sun, 10 Sep 2023 19:03:22 +0200 Subject: [PATCH] feat: introduce routing --- README.md | 4 ++-- src/lib/InstantSearch.svelte | 20 ++++++++++++++++++++ src/lib/getServerState.ts | 6 +++--- src/routes/+page.server.ts | 3 ++- src/routes/+page.svelte | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3724283..385e16e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ npm install svelte-algolia-instantsearch algoliasearch const searchClient = algoliasearch("", ""); - + @@ -60,7 +60,7 @@ import { getServerState } from "svelte-algolia-instantsearch"; import Page from "./+page.svelte"; -export const load = () => getServerState(Page); +export const load = ({ url }) => getServerState(Page, url); ``` Now you can check in your network tab that the page containing hits and facets is fully rendered on the server 😁 diff --git a/src/lib/InstantSearch.svelte b/src/lib/InstantSearch.svelte index c52cc22..23ee331 100644 --- a/src/lib/InstantSearch.svelte +++ b/src/lib/InstantSearch.svelte @@ -1,6 +1,7 @@