From 28a15365d654c0228bab42174b7c74830aa0b2ed Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 Nov 2023 20:58:22 -0600 Subject: [PATCH] fix(web): search returns all value (#5210) --- .../shared-components/search-bar/search-bar.svelte | 2 +- web/src/routes/(user)/search/+page.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/web/src/lib/components/shared-components/search-bar/search-bar.svelte b/web/src/lib/components/shared-components/search-bar/search-bar.svelte index 5e0f2eabe..af36786ef 100644 --- a/web/src/lib/components/shared-components/search-bar/search-bar.svelte +++ b/web/src/lib/components/shared-components/search-bar/search-bar.svelte @@ -33,7 +33,7 @@ showBigSearchBar = false; $isSearchEnabled = false; - goto(`${AppRoute.SEARCH}?${params}`); + goto(`${AppRoute.SEARCH}?${params}`, { invalidateAll: true }); } const clearSearchTerm = (searchTerm: string) => { diff --git a/web/src/routes/(user)/search/+page.ts b/web/src/routes/(user)/search/+page.ts index ce150a37b..0bd978efe 100644 --- a/web/src/routes/(user)/search/+page.ts +++ b/web/src/routes/(user)/search/+page.ts @@ -2,11 +2,10 @@ import { authenticate } from '$lib/utils/auth'; import { api } from '@api'; import type { PageLoad } from './$types'; -export const load = (async () => { +export const load = (async (data) => { const user = await authenticate(); - const url = new URL(location.href); + const url = new URL(data.url.href); const term = url.searchParams.get('q') || url.searchParams.get('query') || undefined; - const { data: results } = await api.searchApi.search({}, { params: url.searchParams }); return {