Skip to content

Commit

Permalink
Replicate live search optimization heuristic to the repositories page
Browse files Browse the repository at this point in the history
Turns out searches without trigrams can even be slow on the repos page!
  • Loading branch information
isker committed Nov 14, 2023
1 parent 41bb950 commit 37dacde
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-eels-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"neogrok": patch
---

Replicate live search optimization heuristic to the repositories page
10 changes: 6 additions & 4 deletions src/routes/repositories/search-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@

<form
on:submit|preventDefault={() => {
if ($searchType === "manual") {
manualSubmit();
}
manualSubmit();
}}
>
<!-- Make enter key submission work: https://stackoverflow.com/a/35235768 -->
Expand All @@ -71,7 +69,11 @@
<input
bind:value={query}
on:input={() => {
if ($searchType === "live") {
if (
$searchType === "live" &&
// Same trigram efficiency rules as on the main search page.
(!query || query.length >= 3)
) {
updateRouteListQuery({ query, searchType: $searchType });
}
}}
Expand Down

0 comments on commit 37dacde

Please sign in to comment.