From 71abdb2ee3f5bdb1e029c9f4266f4b797fa960f9 Mon Sep 17 00:00:00 2001
From: Sam Nystrom <sam@samnystrom.dev>
Date: Thu, 14 Mar 2024 00:10:12 +0000
Subject: fix: memoize stuff

---
 src/pages/LogIn.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/pages/LogIn.tsx')

diff --git a/src/pages/LogIn.tsx b/src/pages/LogIn.tsx
index 3142da4..296a499 100644
--- a/src/pages/LogIn.tsx
+++ b/src/pages/LogIn.tsx
@@ -1,4 +1,4 @@
-import { useContext } from 'preact/hooks';
+import { useContext, useCallback } from 'preact/hooks';
 import { useSignal } from '@preact/signals';
 import { route } from 'preact-router';
 import { Pb } from '../context.ts';
@@ -10,13 +10,13 @@ const LogIn = () => {
 	const email = useSignal('');
 	const password = useSignal('');
 
-	const onSubmit = async (event: SubmitEvent) => {
+	const onSubmit = useCallback(async (event: SubmitEvent) => {
 		event.preventDefault();
 		await pb.collection('users').authWithPassword(email.value, password.value);
 		if (pb.authStore.isValid) {
 			route('/' + pb.authStore.model.username);
 		}
-	};
+	}, []);
 
 	return (
 		<>
-- 
cgit v1.2.3

