Overview
This guide provides solutions to common issues you might encounter while developing or deploying Q-Sopa.API Connection Issues
Categories not loading
Categories not loading
Problem: Categories fail to load and you see “Cargando…” indefinitely or an error message.Diagnosis: Check the browser console for error messages.Solutions:
- Verify API endpoint in
src/services/api.js:
- Test the API directly:
- Check network requests in browser DevTools (Network tab):
- Look for failed requests (red status codes)
- Verify the request URL is correct
- Check response status (should be 200)
- Common fixes:
Products not displaying
Products not displaying
Problem: Categories load but products don’t appear when clicking a category.Check these in
src/pages/Menu.jsx:- Verify state management:
- Check the useEffect dependency:
- Verify API returns correct data format: The API should return an array of products:
- Check category ID is being passed correctly:
API timeout errors
API timeout errors
Problem: Requests time out or take too long.Solution: Add timeout handling:
CORS Errors
CORS policy blocked request
CORS policy blocked request
Error: “Access to fetch at ‘https://…’ from origin ‘http://localhost:5173’ has been blocked by CORS policy”Cause: The API server doesn’t allow requests from your domain.Solutions:Fastify:Then update
1. Backend Configuration (Recommended)
If you control the API, add CORS headers:Express.js:2. Development Proxy
Use Vite’s proxy feature for development. Updatevite.config.js:src/services/api.js:3. Verify Request Headers
Check if credentials are needed:Preflight OPTIONS request failing
Preflight OPTIONS request failing
Problem: CORS preflight requests are being rejected.Solution: Ensure your API handles OPTIONS requests:
Build Errors
Module not found errors
Module not found errors
Error:
Error: Cannot find module '@vitejs/plugin-react'Solutions:- Clean install dependencies:
- Verify package.json:
- Check Node version:
- Clear npm cache:
Tailwind CSS not working
Tailwind CSS not working
Problem: Tailwind classes are not being applied.Note: Q-Sopa uses Tailwind CSS v4. Check configuration:
- Verify installation:
- Check import in
src/index.css:
- Ensure CSS is imported in
src/main.jsx:
- Rebuild:
Build fails with memory errors
Build fails with memory errors
Error: “JavaScript heap out of memory”Solution: Increase Node.js memory limit:Or update
package.json:Development Server Issues
Port already in use
Port already in use
Error:
Port 5173 is already in useSolutions:- Kill the process using the port:
- Use a different port in
vite.config.js:
- Let Vite choose automatically:
Hot reload not working
Hot reload not working
Problem: Changes don’t reflect immediately in the browser.Solutions:
- Check file watching in
vite.config.js:
- Clear browser cache:
- Open DevTools
- Right-click refresh button
- Select “Empty Cache and Hard Reload”
- Restart dev server:
Slow development server
Slow development server
Problem: Server takes long to start or respond.Solutions:
- Optimize dependencies in
vite.config.js:
- Clear Vite cache:
- Disable source maps for faster builds:
Component Rendering Issues
Images not loading
Images not loading
Problem: Product images show broken image icons.Diagnosis:
- Check image URLs in browser DevTools Network tab
- Verify API response contains valid
imageUrlfields
- Add error handling in
ProductCard.jsx:
- Check CORS for images: Some CDNs block cross-origin image requests
- Verify image paths if using local assets:
Material Symbols icons not showing
Material Symbols icons not showing
Problem: Category icons appear as text or don’t render.Solution: Verify Material Symbols is loaded in Check in
index.html:Categories.jsx usage:Mobile drawer not opening
Mobile drawer not opening
Problem: Hamburger menu doesn’t open on mobile.Check these in
src/components/Categories/Categories.jsx:- State is defined:
- Button click handler:
- CSS classes are correct:
- Overlay closes drawer:
- Test on actual mobile device, not just browser resize (touch events may differ)
Categories not highlighting when active
Categories not highlighting when active
Problem: Active category doesn’t show visual feedback.Solution: Verify state comparison in If IDs don’t match (e.g.,
Categories.jsx:1 vs "1"), convert them:State Management Issues
State not updating
State not updating
Problem: State changes don’t trigger re-renders.Common causes:
- Mutating state directly:
- Async setState:
- Missing dependencies in useEffect:
Infinite render loop
Infinite render loop
Problem: Component keeps re-rendering indefinitely.Cause: State update in render or missing useEffect dependencies.Solution:Check useEffect dependencies:
Browser Compatibility
App not working in older browsers
App not working in older browsers
Problem: Features don’t work in Safari, older Edge, etc.Solution: Check browser support and add polyfills if needed:
- Check compatibility:
- Optional chaining (
?.) requires modern browsers Promise.finally()needs polyfills for IE11
- Target specific browsers in
package.json:
- Use Vite’s legacy plugin for older browsers:
Performance Issues
Slow loading / Large bundle size
Slow loading / Large bundle size
Problem: Application takes long to load.Solutions:
- Analyze bundle size:
- Implement code splitting:
- Optimize images:
- Use WebP format
- Compress images (TinyPNG, Squoosh)
- Implement lazy loading
- Enable compression on hosting platform (gzip/brotli)
Memory leaks
Memory leaks
Problem: Application slows down over time.Solution: Clean up effects in Cancel fetch requests on unmount:
Categories.jsx:Getting Help
If you’re still experiencing issues:- Check browser console for error messages
- Review network requests in DevTools
- Test API endpoints directly with curl or Postman
- Verify environment variables are set correctly
- Check package versions match the documentation
Next Steps
Customization
Customize the application
Deployment
Deploy to production
