Skip to content

Blank Screen After Bot Debate Result (Scores Judged, UI Not Shown)#360

Open
Naman-kr404 wants to merge 6 commits intoAOSSIE-Org:mainfrom
Naman-kr404:fix/blank-screen-bug
Open

Blank Screen After Bot Debate Result (Scores Judged, UI Not Shown)#360
Naman-kr404 wants to merge 6 commits intoAOSSIE-Org:mainfrom
Naman-kr404:fix/blank-screen-bug

Conversation

@Naman-kr404
Copy link

@Naman-kr404 Naman-kr404 commented Mar 19, 2026

Addressed Issues:

Fixes ##306, ##347

  • DebateRoom.tsx now guards/normalizes invalid judge payloads into a safe default JudgmentData.
  • JudgementPopup.tsx now reads scores/reasons with optional chaining + fallbacks, so even if sections are missing, it returns {score: 0, reason: ""} instead of throwing.

Screenshots/Recordings:

After
image

Summary by CodeRabbit

  • Bug Fixes

    • More resilient handling of malformed or missing judgment data with safe fallbacks to avoid crashes
    • Improved verdict display to show clear fallback text when results are unavailable
    • Smoother judgment modal transition to reduce visual glitches
  • New Features

    • Opening statements and phase messages now render as formatted bullet lists for improved readability
  • Chores

    • Minor package configuration formatting tidy-up

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8720821-557b-4a1e-8934-63bbcc38fd4a

📥 Commits

Reviewing files that changed from the base of the PR and between 892e4be and 1530e2c.

📒 Files selected for processing (1)
  • frontend/src/components/JudgementPopup.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/JudgementPopup.tsx

📝 Walkthrough

Walkthrough

Modified the bot opening-statement prompt to request bullet-point arguments; hardened frontend judgment handling and rendering to tolerate malformed/partial judge responses; small package.json indentation change.

Changes

Cohort / File(s) Summary
Backend Prompt Update
backend/services/debatevsbot.go
Updated opening-statement prompt template to instruct the model to present its opening argument "in bullet points". Minor whitespace edit adjacent to prompt construction.
Frontend Packaging
frontend/package.json
Re-indented the devDependencies key (whitespace-only change). No dependency/version or script modifications.
Judgment Handling & UI Resilience
frontend/src/Pages/DebateRoom.tsx, frontend/src/components/JudgementPopup.tsx
Added validation and fallback (safeJudgment) for malformed judge responses; made popup→judgment-modal transition asynchronous; added conditional bullet-list rendering for phase messages; hardened JudgementPopup props and score/reason extraction with optional chaining, coercion helpers, and try/catch. Props now accept botDesc?: string.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
With bullets neat, my opening sings,
I guard the scores with careful springs.
If JSON breaks or verdicts hide,
I patch the gaps and hold the tide.
The rabbit hops — safe code, with pride. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main issue being addressed: handling blank screen errors when debate results are received from the bot, with scores properly judged but UI failing to display.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
frontend/src/components/JudgementPopup.tsx (1)

296-316: Simplify redundant null-safe patterns.

Since getScoreAndReason() now guarantees reason is always a string (via asString helper), the complex fallback pattern calling the function twice is unnecessary. The current code calls getScoreAndReason twice for each reason value.

♻️ Suggested simplification
 const player1Reasons = {
-      opening: getScoreAndReason(
-        'opening_statement',
-        'player1'
-      ).reason?.toLowerCase?.() ?? String(getScoreAndReason('opening_statement', 'player1').reason || '').toLowerCase(),
+      opening: getScoreAndReason('opening_statement', 'player1').reason.toLowerCase(),
       cross_questions: isUserBotFormat
-        ? (getScoreAndReason('cross_examination', 'player1').reason?.toLowerCase?.() ??
-            String(getScoreAndReason('cross_examination', 'player1').reason || '').toLowerCase())
-        : getScoreAndReason(
-            'cross_examination_questions',
-            'player1'
-          ).reason?.toLowerCase?.() ??
-          String(getScoreAndReason('cross_examination_questions', 'player1').reason || '').toLowerCase(),
+        ? getScoreAndReason('cross_examination', 'player1').reason.toLowerCase()
+        : getScoreAndReason('cross_examination_questions', 'player1').reason.toLowerCase(),
       cross_answers: isUserBotFormat
-        ? (getScoreAndReason('answers', 'player1').reason?.toLowerCase?.() ??
-            String(getScoreAndReason('answers', 'player1').reason || '').toLowerCase())
-        : getScoreAndReason(
-            'cross_examination_answers',
-            'player1'
-          ).reason?.toLowerCase?.() ??
-          String(getScoreAndReason('cross_examination_answers', 'player1').reason || '').toLowerCase(),
-      closing:
-        getScoreAndReason('closing', 'player1').reason?.toLowerCase?.() ??
-        String(getScoreAndReason('closing', 'player1').reason || '').toLowerCase(),
+        ? getScoreAndReason('answers', 'player1').reason.toLowerCase()
+        : getScoreAndReason('cross_examination_answers', 'player1').reason.toLowerCase(),
+      closing: getScoreAndReason('closing', 'player1').reason.toLowerCase(),
     };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/JudgementPopup.tsx` around lines 296 - 316, The
repeated null-safe fallback calls to getScoreAndReason(...) should be simplified
because reason is guaranteed to be a string; replace each double-call pattern
with a single call and reuse its .reason (e.g., call
getScoreAndReason('opening_statement','player1') once and compute
.reason.toLowerCase()), and do the same for keys cross_questions, cross_answers,
closing while preserving the isUserBotFormat conditional branches and using the
single-call result in each branch to avoid duplicate invocation.
frontend/src/Pages/DebateRoom.tsx (1)

724-733: Remove commented-out dead code.

The commented line {/* {msg.text} */} should be removed as it's no longer needed.

🧹 Suggested fix
-            {/* {msg.text} */}
-            {msg.text.includes("- ") ? (
+            {msg.text.includes("- ") ? (
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/Pages/DebateRoom.tsx` around lines 724 - 733, Remove the dead
commented JSX line containing "{/* {msg.text} */}" inside the DebateRoom
component's render block: open the JSX that conditionally renders msg.text (the
ternary using msg.text.includes and the <ul> / <div
className="whitespace-pre-line"> branches) and delete that commented-out line so
only the active rendering logic remains; ensure no other comments or whitespace
changes affect the surrounding JSX.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/src/components/JudgementPopup.tsx`:
- Around line 296-316: The repeated null-safe fallback calls to
getScoreAndReason(...) should be simplified because reason is guaranteed to be a
string; replace each double-call pattern with a single call and reuse its
.reason (e.g., call getScoreAndReason('opening_statement','player1') once and
compute .reason.toLowerCase()), and do the same for keys cross_questions,
cross_answers, closing while preserving the isUserBotFormat conditional branches
and using the single-call result in each branch to avoid duplicate invocation.

In `@frontend/src/Pages/DebateRoom.tsx`:
- Around line 724-733: Remove the dead commented JSX line containing "{/*
{msg.text} */}" inside the DebateRoom component's render block: open the JSX
that conditionally renders msg.text (the ternary using msg.text.includes and the
<ul> / <div className="whitespace-pre-line"> branches) and delete that
commented-out line so only the active rendering logic remains; ensure no other
comments or whitespace changes affect the surrounding JSX.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 658ce919-7dc9-48c6-aaac-137a78e75387

📥 Commits

Reviewing files that changed from the base of the PR and between 09ef1bb and 892e4be.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • backend/services/debatevsbot.go
  • frontend/package.json
  • frontend/src/Pages/DebateRoom.tsx
  • frontend/src/components/JudgementPopup.tsx

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.

1 participant