fix
Browse files22 unmodified lines232425262728316 unmodified lines345346347348349350351352353354426 unmodified lines78178278378478578678778878979022 unmodified linesconst [currentRepoId, setCurrentRepoId] = useState<string | null>(null); // Track imported/deployed spaceconst [username, setUsername] = useState<string | null>(null); // Track current userconst [pendingPR, setPendingPR] = useState<{ repoId: string; language: Language } | null>(null); // Track pending PR after redesign// Landing page state - show landing page if no messages existconst [showLandingPage, setShowLandingPage] = useState(true);316 unmodified lines});// Check if we need to create a PR (redesign with PR option)if (pendingPR) {console.log('[PR] Creating pull request for:', pendingPR.repoId);createPullRequestAfterGeneration(pendingPR.repoId, code, pendingPR.language);setPendingPR(null); // Clear pending PR}},// onError426 unmodified lines// Hide landing page immediately for smooth transitionsetShowLandingPage(false);// If shouldCreatePR is true, set pending PR stateif (shouldCreatePR && repoId) {console.log('[PR] Setting pending PR for:', repoId);setPendingPR({ repoId, language });}// Send the message with the selected language and model22 unmodified lines23242526272829316 unmodified lines346347348349350351352353354355356357358359360361426 unmodified lines78878979079179279379479579679779879922 unmodified linesconst [currentRepoId, setCurrentRepoId] = useState<string | null>(null); // Track imported/deployed spaceconst [username, setUsername] = useState<string | null>(null); // Track current userconst [pendingPR, setPendingPR] = useState<{ repoId: string; language: Language } | null>(null); // Track pending PR after redesignconst pendingPRRef = useRef<{ repoId: string; language: Language } | null>(null); // Ref for immediate access// Landing page state - show landing page if no messages existconst [showLandingPage, setShowLandingPage] = useState(true);316 unmodified lines});// Check if we need to create a PR (redesign with PR option)console.log('[PR] onComplete - Checking pendingPR ref:', pendingPRRef.current);console.log('[PR] onComplete - Checking pendingPR state:', pendingPR);const prInfo = pendingPRRef.current;if (prInfo) {console.log('[PR] Creating pull request for:', prInfo.repoId);createPullRequestAfterGeneration(prInfo.repoId, code, prInfo.language);setPendingPR(null); // Clear statependingPRRef.current = null; // Clear ref} else {console.log('[PR] No pending PR - skipping PR creation');}},// onError426 unmodified lines// Hide landing page immediately for smooth transitionsetShowLandingPage(false);// If shouldCreatePR is true, set pending PR state and refif (shouldCreatePR && repoId) {console.log('[PR] Setting pending PR for:', repoId);const prInfo = { repoId, language };setPendingPR(prInfo);pendingPRRef.current = prInfo; // Set ref immediately for synchronous access}// Send the message with the selected language and model
frontend/src/app/page.tsx+15-6