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/SignUp.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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

diff --git a/src/pages/SignUp.tsx b/src/pages/SignUp.tsx
index 6e2c874..22e1512 100644
--- a/src/pages/SignUp.tsx
+++ b/src/pages/SignUp.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';
@@ -12,7 +12,7 @@ const SignUp = () => {
 	const password = useSignal('');
 	const confirm = useSignal('');
 
-	const onSubmit = async (event: SubmitEvent) => {
+	const onSubmit = useCallback(async (event: SubmitEvent) => {
 		event.preventDefault();
 		await pb.collection('users').create({
 			username: username.value,
@@ -24,7 +24,7 @@ const SignUp = () => {
 		if (pb.authStore.isValid) {
 			route('/' + pb.authStore.model.username);
 		}
-	};
+	}, []);
 
 	return (
 		<>
-- 
cgit v1.2.3

