From aa744e290ce889d22d801484b6cf46d71171c343 Mon Sep 17 00:00:00 2001 From: defiQUG Date: Fri, 23 Jan 2026 16:52:10 -0800 Subject: [PATCH] Fix build errors: useCallback syntax and API module check --- apps/api/src/index.ts | 4 ++-- apps/web/src/pages/TransactionsPage.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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);