fix: add radix parameter to parseInt calls - #1093
Conversation
|
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 — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
WalkthroughBoth public room page fetchers now catch rejected fetch or JSON parsing promises and log the errors with ChangesPublic room fetch error handling
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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.tsxFile contains syntax errors that prevent linting: Line 26: Expected a statement but instead found '.catch(err => console.error(err))'.; Line 26: expected src/app/(routes)/public-rooms/page.tsxFile contains syntax errors that prevent linting: Line 66: Expected a statement but instead found '.catch(err => console.error(err))'.; Line 66: expected 🔧 ESLint
src/app/(routes)/public-rooms/[subject]/page.tsxParsing error: Declaration or statement expected. src/app/(routes)/public-rooms/page.tsxParsing 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. Comment |
|
@coderabbitai review |
| </div> | ||
| ); | ||
| } No newline at end of file | ||
| .catch(err => console.error(err)) No newline at end of file |
There was a problem hiding this comment.
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.(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 fixThere was a problem hiding this comment.
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
📒 Files selected for processing (2)
src/app/(routes)/public-rooms/[subject]/page.tsxsrc/app/(routes)/public-rooms/page.tsx
| </div> | ||
| ); | ||
| } No newline at end of file | ||
| .catch(err => console.error(err)) No newline at end of file |
There was a problem hiding this comment.
🎯 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' || trueRepository: 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);
}
}
JSRepository: 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
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
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:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
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:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
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