From 10fdbe9cee51d4c68a8ed4d0110f05e30c82576f Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Mon, 27 Apr 2026 07:31:19 +0800 Subject: [PATCH] chore: build cleanup, fix lint errors in our changes, fix login Suspense boundary --- app/(auth)/login/page.tsx | 7 ++++++- components/wizard/steps/environment-step.tsx | 17 +++++++++-------- lib/api/performance-submit.ts | 3 +-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index ab21ea4..65d66e0 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -1,5 +1,10 @@ +import { Suspense } from "react" import LoginForm from "@/components/auth/login-form" export default function LoginPage() { - return + return ( + + + + ) } diff --git a/components/wizard/steps/environment-step.tsx b/components/wizard/steps/environment-step.tsx index 4b2b89d..6756f3f 100644 --- a/components/wizard/steps/environment-step.tsx +++ b/components/wizard/steps/environment-step.tsx @@ -54,12 +54,10 @@ function AutocompleteInput({ const [suggestions, setSuggestions] = useState([]) const [loading, setLoading] = useState(false) const [open, setOpen] = useState(false) - const [inputValue, setInputValue] = useState(value) + const [localValue, setLocalValue] = useState("") + const [isFocused, setIsFocused] = useState(false) const containerRef = useRef(null) - - useEffect(() => { - setInputValue(value) - }, [value]) + const inputValue = isFocused ? localValue : (value ?? "") useEffect(() => { function handleClickOutside(e: MouseEvent) { @@ -93,19 +91,21 @@ function AutocompleteInput({ ) const handleFocus = () => { + setLocalValue(value ?? "") + setIsFocused(true) setOpen(true) - fetchSuggestions(inputValue) + fetchSuggestions(value ?? "") } const handleChange = (val: string) => { - setInputValue(val) + setLocalValue(val) onChange(val) fetchSuggestions(val) setOpen(true) } const handleSelect = (val: string) => { - setInputValue(val) + setLocalValue(val) onChange(val) setOpen(false) } @@ -119,6 +119,7 @@ function AutocompleteInput({ value={inputValue} onChange={(e) => handleChange(e.target.value)} onFocus={handleFocus} + onBlur={() => setIsFocused(false)} placeholder={placeholder} className="w-full px-4 py-3 rounded-lg border border-border bg-text/5 text-text text-sm placeholder:text-text/40 outline-none focus:border-primary focus:ring-2 focus:ring-primary/50 transition-colors" /> diff --git a/lib/api/performance-submit.ts b/lib/api/performance-submit.ts index c31259a..595bd91 100644 --- a/lib/api/performance-submit.ts +++ b/lib/api/performance-submit.ts @@ -1,12 +1,11 @@ import { Elysia, t } from "elysia" -import { auth } from "@/lib/auth" import { db } from "@/lib/db/index" import { performanceEntries, gameVersions, hardware, } from "@/lib/db/schema" -import { eq, sql, and } from "drizzle-orm" +import { eq, sql } from "drizzle-orm" import { requireRole } from "@/lib/auth/guard" export const performanceSubmitRoutes = new Elysia({ prefix: "/performance" })