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

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

diff --git a/src/pages/ProjectsList.tsx b/src/pages/ProjectsList.tsx
index 3d86358..a7e3bed 100644
--- a/src/pages/ProjectsList.tsx
+++ b/src/pages/ProjectsList.tsx
@@ -1,4 +1,4 @@
-import { useContext, useEffect } from 'preact/hooks';
+import { useContext, useEffect, useCallback } from 'preact/hooks';
 import { useSignal } from '@preact/signals';
 import { route } from 'preact-router';
 import { Pb } from '../context.ts';
@@ -6,7 +6,6 @@ import { logOut } from '../util.ts';
 import { Header, Content, ContainedList, Form, FormLabel, TextInput, Button } from '../components';
 
 const ProjectsList = ({ user }) => {
-	console.log(user);
 	const pb = useContext(Pb);
 	const projects = useSignal(null);
 	const projectName = useSignal('');
@@ -17,14 +16,14 @@ const ProjectsList = ({ user }) => {
 			.then(p => projects.value = p);
 	}, []);
 
-	const onCreateProject = async (event: FormEvent) => {
+	const onCreateProject = useCallback(async (event: FormEvent) => {
 		event.preventDefault();
 		const project = await pb.collection('projects').create({
 			name: projectName.value,
 			owner: pb.authStore.model.id,
 		});
 		route(`/${user}/${project.name}`);
-	};
+	}, [user]);
 
 	return (
 		<>
-- 
cgit v1.2.3

