diff --git a/Dockerfile b/Dockerfile index e727491..e57d2f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,8 @@ WORKDIR /app/frontend # Copy package files COPY frontend/package*.json ./ -# Install dependencies -RUN npm ci --only=production +# Install dependencies (including dev dependencies for build) +RUN npm ci # Copy source code COPY frontend/ ./ diff --git a/frontend/src/components/CounterDetail.tsx b/frontend/src/components/CounterDetail.tsx index 03cca99..ac47b55 100644 --- a/frontend/src/components/CounterDetail.tsx +++ b/frontend/src/components/CounterDetail.tsx @@ -1,10 +1,10 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { useCounters } from '../hooks/useCounters'; import { useAuth } from '../hooks/useAuth'; import { CounterWithStats, CounterEntry } from '../types'; import { countersAPI } from '../services/api'; -import { ArrowLeft, Plus, Minus, Edit, Trash2, Calendar, TrendingUp } from 'lucide-react'; +import { ArrowLeft, Plus, Minus, Trash2, Calendar } from 'lucide-react'; import { format } from 'date-fns'; export const CounterDetail: React.FC = () => { @@ -19,13 +19,7 @@ export const CounterDetail: React.FC = () => { const [isIncrementing, setIsIncrementing] = useState(false); const [error, setError] = useState(null); - useEffect(() => { - if (id) { - loadCounterData(); - } - }, [id]); - - const loadCounterData = async () => { + const loadCounterData = useCallback(async () => { if (!id) return; setIsLoading(true); @@ -95,7 +89,13 @@ export const CounterDetail: React.FC = () => { } finally { setIsLoading(false); } - }; + }, [id, isAuthenticated]); + + useEffect(() => { + if (id) { + loadCounterData(); + } + }, [id, loadCounterData]); const handleIncrement = async (value: number) => { if (!counter) return; diff --git a/frontend/src/components/Dashboard.tsx b/frontend/src/components/Dashboard.tsx index 01bf439..2be3583 100644 --- a/frontend/src/components/Dashboard.tsx +++ b/frontend/src/components/Dashboard.tsx @@ -1,5 +1,4 @@ import React, { useState } from 'react'; -import { Link } from 'react-router-dom'; import { useCounters } from '../hooks/useCounters'; import { useAuth } from '../hooks/useAuth'; import { CreateCounterModal } from './CreateCounterModal';