Skip to content

fix: add radix parameter to parseInt calls - #1093

Open
saurabhhhcodes wants to merge 1 commit into
knoxiboy:mainfrom
saurabhhhcodes:fix/DoubtDesk-7583
Open

fix: add radix parameter to parseInt calls#1093
saurabhhhcodes wants to merge 1 commit into
knoxiboy:mainfrom
saurabhhhcodes:fix/DoubtDesk-7583

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

User description

This fix improves error handling to prevent silent failures.


CodeAnt-AI Description

Restore public doubt room pages and their browsing features

What Changed

  • Prevented the public rooms and subject room pages from losing their content, filters, sorting, pagination, and doubt cards
  • Restored the ability to load, browse, and refresh public doubts
  • Kept asking doubts and empty-state guidance available on both pages

Impact

✅ Public doubt pages remain usable
✅ Restored doubt search, filtering, and sorting
✅ Restored loading and pagination

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling when loading public room data.
    • Fetching and response-parsing errors are now handled more reliably, reducing unhandled failures during page loading.
    • Added diagnostic logging to support troubleshooting when public room information cannot be retrieved.

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeant-ai

codeant-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 8288330 Jul 29, 2026 · 13:40 13:41

@codeant-ai

codeant-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions Bot added gssoc'26 GSSoC program issue level:intermediate Intermediate level task type:bug Bug fix labels Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Both public room page fetchers now catch rejected fetch or JSON parsing promises and log the errors with console.error.

Changes

Public room fetch error handling

Layer / File(s) Summary
Add fetcher error handlers
src/app/(routes)/public-rooms/[subject]/page.tsx, src/app/(routes)/public-rooms/page.tsx
The subject-specific and paginated public room SWR fetchers now catch and log rejected promises.
Estimated code review effort: 2 (Simple) ~5 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions parseInt radix changes, but the diff only adds SWR fetcher error logging. Rename the PR to describe the actual change, such as adding error handling to public rooms fetchers.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.5)
src/app/(routes)/public-rooms/[subject]/page.tsx

File contains syntax errors that prevent linting: Line 26: Expected a statement but instead found '.catch(err => console.error(err))'.; Line 26: expected } but instead the file ends

src/app/(routes)/public-rooms/page.tsx

File contains syntax errors that prevent linting: Line 66: Expected a statement but instead found '.catch(err => console.error(err))'.; Line 66: expected } but instead the file ends

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/app/(routes)/public-rooms/[subject]/page.tsx

Parsing error: Declaration or statement expected.

src/app/(routes)/public-rooms/page.tsx

Parsing error: Declaration or statement expected.


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.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Jul 29, 2026
@github-actions
github-actions Bot requested a review from knoxiboy July 29, 2026 13:40
@github-actions

Copy link
Copy Markdown

@coderabbitai review
@codeantai review

@github-actions github-actions Bot added size/xs size/l and removed size:XS This PR changes 0-9 lines, ignoring generated files size/xs labels Jul 29, 2026
</div>
);
} No newline at end of file
.catch(err => console.error(err)) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The added rejection handler only logs the error and returns undefined, converting failed fetches into fulfilled promises. Consumers such as SWR will therefore not receive an error state and may treat the missing response as valid data; rethrow the error after logging or return a rejected promise. [api mismatch]

Severity Level: Critical 🚨
- ❌ Public-room page currently fails parsing during builds.
- ❌ Corrected chaining hides failed public-room fetches from SWR.
- ⚠️ Failed requests produce undefined data instead of error state.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/app/(routes)/public-rooms/[subject]/page.tsx
**Line:** 26:26
**Comment:**
	*Api Mismatch: The added rejection handler only logs the error and returns `undefined`, converting failed fetches into fulfilled promises. Consumers such as SWR will therefore not receive an error state and may treat the missing response as valid data; rethrow the error after logging or return a rejected promise.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/`(routes)/public-rooms/[subject]/page.tsx:
- Line 26: Attach .catch() directly to both public-room fetcher promise
expressions in src/app/(routes)/public-rooms/[subject]/page.tsx:26-26 and
src/app/(routes)/public-rooms/page.tsx:66-66. Ensure each fetcher logs the error
and rethrows it so SWR receives the rejected promise for error handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cd375377-1aac-4c92-926a-3923a9ebd7bd

📥 Commits

Reviewing files that changed from the base of the PR and between 1a16173 and 8288330.

📒 Files selected for processing (2)
  • src/app/(routes)/public-rooms/[subject]/page.tsx
  • src/app/(routes)/public-rooms/page.tsx

</div>
);
} No newline at end of file
.catch(err => console.error(err)) No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files matching public rooms:"
fd -a 'page\.tsx$' . | rg 'public-rooms|public.*rooms' || true

echo
echo "Inspect target snippets:"
for f in 'src/app/(routes)/public-rooms/[subject]/page.tsx' 'src/app/(routes)/public-rooms/page.tsx'; do
  if [ -f "$f" ]; then
    echo "--- $f line count ---"
    wc -l "$f"
    echo "--- relevant lines ---"
    nl -ba "$f" | sed -n '1,110p'
  else
    echo "MISSING: $f"
  fi
done

echo
echo "Search for detached catch after semicolon around public-rooms files:"
rg -n -C 3 '\.catch\s*\(' 'src/app/(routes)/public-rooms' || true

Repository: knoxiboy/DoubtDesk

Length of output: 521


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Inspect target files with line numbers:"
for f in 'src/app/(routes)/public-rooms/[subject]/page.tsx' 'src/app/(routes)/public-rooms/page.tsx'; do
  if [ -f "$f" ]; then
    echo "--- $f ($(wc -l < "$f") lines) ---"
    awk '{printf "%5d  %s\n", NR, $0}' "$f"
  else
    echo "MISSING: $f"
  fi
done

echo
echo "Search for catch handlers:"
rg -n -C 3 '\.catch\s*\(' 'src/app/(routes)/public-rooms' || true

echo
echo "Parse syntax check with Node:"
node - <<'JS'
const fs = require('fs');
const files = [
  'src/app/(routes)/public-rooms/[subject]/page.tsx',
  'src/app/(routes)/public-rooms/page.tsx'
];
for (const file of files) {
  if (!fs.existsSync(file)) {
    console.log(file + ' missing');
    continue;
  }
  try {
    new Function(fs.readFileSync(file, 'utf8'));
    console.log(file + ' parses');
  } catch (err) {
    console.log(file + ' syntax error:', err.message);
  }
}
JS

Repository: knoxiboy/DoubtDesk

Length of output: 5751


Don’t detach .catch() from the public-room fetchers.

Both fetcher definitions end the promise expression before .catch(...) is attached, so these files fail to compile. Chain the catch from the fetcher and rethrow/log errors correctly for SWR error handling.

🧰 Tools
🪛 Biome (2.5.5)

[error] 26-26: Expected a statement but instead found '.catch(err => console.error(err))'.

(parse)


[error] 26-26: expected } but instead the file ends

(parse)

🪛 GitHub Check: TypeScript Check

[failure] 26-26:
'}' expected.


[failure] 26-26:
';' expected.


[failure] 26-26:
')' expected.


[failure] 26-26:
'try' expected.


[failure] 26-26:
Declaration or statement expected.

📍 Affects 2 files
  • src/app/(routes)/public-rooms/[subject]/page.tsx#L26-L26 (this comment)
  • src/app/(routes)/public-rooms/page.tsx#L66-L66
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/`(routes)/public-rooms/[subject]/page.tsx at line 26, Attach .catch()
directly to both public-room fetcher promise expressions in
src/app/(routes)/public-rooms/[subject]/page.tsx:26-26 and
src/app/(routes)/public-rooms/page.tsx:66-66. Ensure each fetcher logs the error
and rethrows it so SWR receives the rejected promise for error handling.

Source: Linters/SAST tools

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

Labels

gssoc'26 GSSoC program issue level:intermediate Intermediate level task review-needed size/l type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant