From fc4b535d6f69fa25f33207b9e7117027b3c85e55 Mon Sep 17 00:00:00 2001
From: Natsuu <natsukawa247@outlook.com>
Date: Wed, 14 Jan 2026 05:06:23 +0000
Subject: feat: optimize search filtering by using normalized query for better
 accuracy

---
 ui/src/components/VersionsView.svelte | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'ui/src/components/VersionsView.svelte')

diff --git a/ui/src/components/VersionsView.svelte b/ui/src/components/VersionsView.svelte
index 1eba447..27aba7d 100644
--- a/ui/src/components/VersionsView.svelte
+++ b/ui/src/components/VersionsView.svelte
@@ -2,10 +2,13 @@
   import { gameState } from "../stores/game.svelte";
 
   let searchQuery = $state("");
+  let normalizedQuery = $derived(
+    searchQuery.trim().toLowerCase().replaceAll("。", ".")
+  );
 
   let filteredVersions = $derived(
     gameState.versions.filter((v) =>
-      v.id.toLowerCase().includes(searchQuery.trim().toLowerCase().replaceAll("。", "."))
+      v.id.toLowerCase().includes(normalizedQuery)
     )
   );
 </script>
@@ -23,7 +26,7 @@
   <div class="grid gap-2">
     {#if gameState.versions.length === 0}
       <div class="text-zinc-500">Loading versions...</div>
-    {:else if filteredVersions.length === 0}
+    {:else if filteredVersions.length === 0 && normalizedQuery.length > 0}
       <div class="text-zinc-500">No versions found matching "{searchQuery}"</div>
     {:else}
       {#each filteredVersions as version}
-- 
cgit v1.2.3-70-g09d2

