From 457d6f5f39ab43447ebfb0b3117922db8ec05632 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Mon, 27 Apr 2026 13:15:16 +0800 Subject: [PATCH] fix: resolve 3 lint issues - login-form.tsx: suppress unused-vars warning for emailChecked state - bookmark-button.tsx: use function initializer for isLoading to avoid sync setState in effect - saved-games.ts: remove unused 'set' parameter from check endpoint --- components/auth/login-form.tsx | 1 + components/saved-games/bookmark-button.tsx | 7 ++----- lib/api/saved-games.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/auth/login-form.tsx b/components/auth/login-form.tsx index aac5f74..c11c88d 100644 --- a/components/auth/login-form.tsx +++ b/components/auth/login-form.tsx @@ -42,6 +42,7 @@ export default function LoginForm() { const [password, setPassword] = useState("") const [error, setError] = useState("") const [isLoading, setIsLoading] = useState(false) + // eslint-disable-next-line @typescript-eslint/no-unused-vars const [emailChecked, setEmailChecked] = useState(false) const mountedRef = useRef(true) const passkeyInitiatedRef = useRef(false) diff --git a/components/saved-games/bookmark-button.tsx b/components/saved-games/bookmark-button.tsx index 3dd5d71..b11d4b4 100644 --- a/components/saved-games/bookmark-button.tsx +++ b/components/saved-games/bookmark-button.tsx @@ -13,14 +13,11 @@ interface BookmarkButtonProps { export function BookmarkButton({ gameId, className = "" }: BookmarkButtonProps) { const { data: session } = useSession() const [isSaved, setIsSaved] = useState(false) - const [isLoading, setIsLoading] = useState(true) + const [isLoading, setIsLoading] = useState(() => !session) const [isToggling, setIsToggling] = useState(false) useEffect(() => { - if (!session) { - setIsLoading(false) - return - } + if (!session) return async function checkSaved() { try { diff --git a/lib/api/saved-games.ts b/lib/api/saved-games.ts index 955ba40..dfde3b2 100644 --- a/lib/api/saved-games.ts +++ b/lib/api/saved-games.ts @@ -132,7 +132,7 @@ export const savedGamesRoutes = new Elysia({ prefix: "/user/me/saved-games" }) ) .get( "/check/:gameId", - async ({ request, params, set }) => { + async ({ request, params }) => { const session = await auth.api.getSession({ headers: request.headers, })