Troubleshooting Frontend Issues
When to Activate This Skill
Activate this skill when encountering:
- TypeScript compilation errors
- Import resolution failures
- React component errors
- Inertia.js issues
- Wayfinder action generation issues
- Browser console errors
- Type mismatches in React code
Common Frontend Issues and Solutions
Import Resolution Failures
Problem: Cannot find module '@/actions/...'
Cause: Wayfinder action file not generated (route not registered)
Solution:
- Activate
routing-and-controllersskill - Verify the route is registered in
routes/web.php - Run
php artisan wayfinder:generate --no-interaction - Verify the file exists in
resources/js/actions/
TypeScript Compilation Errors
Problem: tsc --noEmit fails with type errors
Cause: Type mismatches or missing type definitions
Solution:
- Read the error message carefully — it shows the exact file and line
- Check if the type is defined in
resources/js/types/generated.d.ts - If missing, run
php artisan typescript:transformon the backend - Verify the PHP class has
@TypeScriptattribute (for Spatie Data)
Missing Type Definitions
Problem: TypeScript can't find types for PHP classes Cause: PHP class not transformed to TypeScript Solution:
- Ensure the PHP class uses Spatie Data with
@TypeScriptattribute - Run
php artisan typescript:transform - Check
resources/js/types/generated.d.tsfor the generated type
React Component Errors
Problem: Component doesn't render or throws error Cause: Props type mismatch, missing data, or logic error Solution:
- Check browser console for error details
- Verify props match the component's type definition
- Check that data is being passed from the backend
- Use React DevTools to inspect component state
Wayfinder Action Issues
Problem: Action method not available (e.g., .form() missing)
Cause: Route not generated with form support
Solution:
php artisan wayfinder:generate --with-form --no-interaction
Then regenerate TypeScript types:
php artisan typescript:transform
Diagnostic Steps
- Check browser console — Look for JavaScript errors
- Run TypeScript check —
npm run types - Check generated files — Verify files exist in
resources/js/actions/andresources/js/types/ - Clear cache —
npm run buildornpm run dev
When to Activate Other Skills
- Backend errors appearing: Activate
troubleshooting-backend - Route/controller questions: Activate
routing-and-controllers - Component structure questions: Activate
inertia-react-development