diff --git a/components/TodoList.tsx b/components/TodoList.tsx index 2208c9b..896200d 100644 --- a/components/TodoList.tsx +++ b/components/TodoList.tsx @@ -38,7 +38,7 @@ export default function TodoList() { useEffect(() => { fetchTodos() - }, []) + }, [fetchTodos]) const handleTodoUpdate = () => { fetchTodos() diff --git a/lib/prisma.ts b/lib/prisma.ts index af2a01e..f3c4896 100644 --- a/lib/prisma.ts +++ b/lib/prisma.ts @@ -4,6 +4,10 @@ const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined } -export const prisma = globalForPrisma.prisma ?? new PrismaClient() +export const prisma = globalForPrisma.prisma ?? new PrismaClient({ + log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'], +}) -if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma +if (process.env.NODE_ENV !== 'production') { + globalForPrisma.prisma = prisma +}