File: FRONTEND/src/pages/ProductPage.jsx (lines 21, 396-416)
Severity: MEDIUM
Problem: If a user sets quantity to 5 for product A, then navigates to product B with stock 3, the quantity state stays at 5 while maxQty is 3. The + button is disabled but the user sees a quantity they cannot reach.
Fix: Add a useEffect to reset quantity to 1 when the product id changes: useEffect(() => setQuantity(1), [id]).
File: FRONTEND/src/pages/ProductPage.jsx (lines 21, 396-416)
Severity: MEDIUM
Problem: If a user sets quantity to 5 for product A, then navigates to product B with stock 3, the quantity state stays at 5 while maxQty is 3. The + button is disabled but the user sees a quantity they cannot reach.
Fix: Add a useEffect to reset quantity to 1 when the product id changes: useEffect(() => setQuantity(1), [id]).