fix(web-ui): remove client-side onKeyDown from server component to fix 500 on /docs

The search input's onKeyDown handler used window.location.href which is
unavailable during SSR, causing the /docs page to crash. Replaced with
a Link wrapper so it's fully server-rendered.
This commit is contained in:
asepharyana committed 2026-08-20 21:34:42 +07:00
1 parent a82af10851
commit 44b887a9a0
1 file changed
+10 -16
+10 -16
View File
@@ -53,9 +53,13 @@ export default async function DocsIndexPage() {
</p> </p>
{/* Search bar */} {/* Search bar */}
<div className="mt-8 relative max-w-2xl"> <div className="mt-8">
<Link
href="/search"
className="relative flex items-center max-w-2xl group"
>
<svg <svg
className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-[#62666d]" className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-[#62666d] group-focus-within:text-[#5e6ad2] transition-colors"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@@ -67,20 +71,10 @@ export default async function DocsIndexPage() {
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
/> />
</svg> </svg>
<input <span className="w-full pl-10 pr-4 py-3 bg-[#191a1b] border border-[#1f2022] rounded-lg text-[#62666d] group-hover:border-[#5e6ad2]/40 transition-colors">
type="text" Search documents, tags, authors...
placeholder="Search documents, tags, authors..." </span>
readOnly </Link>
className="w-full pl-10 pr-4 py-3 bg-[#191a1b] border border-[#1f2022] rounded-lg text-[#e2e4e7] placeholder-[#62666d] focus:outline-none focus:border-[#5e6ad2] focus:ring-1 focus:ring-[#5e6ad2]/30 transition-colors"
onKeyDown={(e) => {
if (e.key === "Enter" && e.currentTarget.value) {
window.location.href = `/search?q=${encodeURIComponent(e.currentTarget.value)}`;
}
}}
/>
<kbd className="absolute right-3 top-1/2 -translate-y-1/2 text-xs text-[#62666d] bg-[#0f1011] border border-[#1f2022] rounded px-1.5 py-0.5">
↵
</kbd>
</div> </div>
{/* Recent strip */} {/* Recent strip */}