Skip to content

Commit

Permalink
Handle empty queries better
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Apr 24, 2024
1 parent e84ce97 commit 328a527
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/routes/app/add-ons/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
const url = new URL($page.url); // make a copy
const formData = new FormData(event.currentTarget as HTMLFormElement);
const query = formData.get("query") ?? "";
if (!query) return;
url.searchParams.set("query", query as string);
goto(url);
}
Expand Down
1 change: 0 additions & 1 deletion src/routes/app/projects/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
const url = new URL($page.url); // make a copy
const formData = new FormData(event.currentTarget as HTMLFormElement);
const query = formData.get("query") ?? "";
if (!query) return;
url.searchParams.set("query", query as string);
goto(url);
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/app/projects/[id]-[slug]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export async function load({ params, url, parent, fetch }) {
const breadcrumbs = await breadcrumbTrail(parent, [
{ href: url.pathname, title: project.title },
]);
const query = url.searchParams.get("q");
const cursor = url.searchParams.get("cursor");
const query = url.searchParams.get("q") ?? "";
const cursor = url.searchParams.get("cursor") ?? "";
const documents = search(query, { cursor, project: project.id });
return {
breadcrumbs,
Expand Down

0 comments on commit 328a527

Please sign in to comment.