diff --git a/package.json b/package.json index 43d8d6a4..babf04c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prednjica", - "version": "0.3.0", + "version": "0.3.2", "private": true, "scripts": { "start": "node ./index.js", diff --git a/src/routes/search/+page.ts b/src/routes/search/+page.ts index f17a3e5e..9b758b88 100644 --- a/src/routes/search/+page.ts +++ b/src/routes/search/+page.ts @@ -1,7 +1,16 @@ import type { PageLoad } from './$types'; import { env } from '$env/dynamic/public'; -export const load: PageLoad = async ({ fetch, url }) => { +export const load: PageLoad = async ({ data, fetch, url }) => { + // this runs on SSR (+page.server.ts) + if (data != null) { + return { + query: data.query, + results: data.results + }; + } + + // this runs on CSR const q = url.searchParams.get('q'); if (q === null || q === '') { return {