From ef52d070d9d23f6d0847789c4284a2aff8405e97 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Mon, 1 Sep 2025 04:56:25 +0000 Subject: [PATCH] Improve search functionality to update URL with search queries Refactors the onChange handler in FolxStadlPage.tsx to update the URL with the search query using `setLocation` whenever the input value changes, ensuring search state is reflected in the URL. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ab9cd02a-d0b2-4288-9ceb-1964d0059648 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/ab9cd02a-d0b2-4288-9ceb-1964d0059648/YOKUxse --- client/src/pages/FolxStadlPage.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/pages/FolxStadlPage.tsx b/client/src/pages/FolxStadlPage.tsx index f748164..1b64e28 100644 --- a/client/src/pages/FolxStadlPage.tsx +++ b/client/src/pages/FolxStadlPage.tsx @@ -100,7 +100,9 @@ export default function FolxStadlPage() { value={searchQuery} onChange={(e) => { setSearchQuery(e.target.value); - if (e.target.value) setLocation(`/?search=${encodeURIComponent(e.target.value)}`); + if (e.target.value) { + setLocation(`/?search=${encodeURIComponent(e.target.value)}`); + } }} className="bg-white border border-gray-300 rounded-lg px-4 py-2 pl-10 text-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:border-bunny-blue transition-colors w-64" /> @@ -152,7 +154,12 @@ export default function FolxStadlPage() { type="search" placeholder="Search..." value={searchQuery} - onChange={(e) => setSearchQuery(e.target.value)} + onChange={(e) => { + setSearchQuery(e.target.value); + if (e.target.value) { + setLocation(`/?search=${encodeURIComponent(e.target.value)}`); + } + }} className="bg-white border border-gray-300 rounded-lg px-3 py-2 pl-9 text-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:border-bunny-blue transition-colors w-full" />