diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 1bb95cf..9961fb5 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -78,8 +78,8 @@ app.use((err: Error, req: Request, res: Response, next: NextFunction) => { }); }); -// Start server -if (require.main === module) { +// Start server (only if running directly, not when imported) +if (typeof require !== 'undefined' && require.main === module) { app.listen(PORT, () => { logger.info(`API server started on port ${PORT}`); }); diff --git a/apps/web/src/pages/TransactionsPage.tsx b/apps/web/src/pages/TransactionsPage.tsx index 6c8245c..43e416e 100644 --- a/apps/web/src/pages/TransactionsPage.tsx +++ b/apps/web/src/pages/TransactionsPage.tsx @@ -35,7 +35,7 @@ export default function TransactionsPage() { const converter = getDefaultConverter(); - const handleSubmit = async (e: React.FormEvent) => { + const handleSubmit = useCallback(async (e: React.FormEvent) => { e.preventDefault(); setErrors({}); setIsProcessing(true);