Skip to content

Fix Vercel deployment - React Hooks violation and build failures#9

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-181355302-1063216817-669b9b2c-f269-43bb-a1cc-a2cb96ac056b
Draft

Fix Vercel deployment - React Hooks violation and build failures#9
Copilot wants to merge 3 commits intomainfrom
copilot/fix-181355302-1063216817-669b9b2c-f269-43bb-a1cc-a2cb96ac056b

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 3, 2025

Build was failing due to React Hooks called conditionally and TypeScript errors.

Core Fixes

  • React Hooks violation: Moved useRouter() before early return in ChildDashboard.tsx (line 185)
  • Button onClick signature: Changed from () => void to (event?: React.MouseEvent<HTMLButtonElement>) => void
  • Type safety: Replaced as any assertions with proper Child type in settings page

Build-Time Firebase Initialization

Firebase attempted initialization during static generation without credentials. Added fallback config with dummy values and forced dynamic rendering for diagnostic pages:

// src/lib/firebase.ts
const firebaseConfig = {
  apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY || 'dummy-api-key-for-build',
  // ... other config with fallbacks
};

// src/app/firebase-diagnostic/page.tsx
export const dynamic = 'force-dynamic';

Type Corrections

  • Removed invalid as Child[], as Parent[], as Subject[], as Lesson[] assertions from seed data
  • Fixed Icon component props to include className?: string
  • Added missing Child type import in settings page

Build now completes successfully. Vercel deployment requires environment variables for Firebase config.

Original prompt

fix the vercel deployment issuse


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
quest4-fun Ready Ready Preview Comment Nov 3, 2025 1:50pm
quest4-fun-j2bt Ready Ready Preview Comment Nov 3, 2025 1:50pm
quest4-fun-zmpb Error Error Nov 3, 2025 1:50pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants