fix(api): suppress error toast during silent requests and update backend startup#110
Conversation
|
@BHOGALA-SRIKA is attempting to deploy a commit to the karan3431's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning
|
| Layer / File(s) | Summary |
|---|---|
safeFetch catch: silent + fetch error detection src/lib/api.ts |
The single-line condition now combines !options?.silent with (error instanceof TypeError || error.toString().includes("fetch")), so background calls passing { silent: true } suppress the connection error toast for both TypeError and other fetch-related errors. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~2 minutes
Possibly related PRs
- jpdevhub/FreshScanAi#97: Modifies
safeFetchinsrc/lib/api.tsto conditionally suppress the connection/fetch toast viaoptions?.silent, directly overlapping with this change's logic.
Suggested labels
size/level: easy
Suggested reviewers
- jpdevhub
Poem
🐇 A silent hop through offline night,
No toast to startle, all is right.
The fetch may fail, the network gone,
But freshness scores still carry on.
silent: true— the bunny's delight! 🌿
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Out of Scope Changes check | PR objectives note unrelated changes to ci.yml, README.md, and start-backend.bat were incorrectly included despite the core fix being limited to src/lib/api.ts. | Rebase onto main to remove out-of-scope changes to ci.yml, README.md, and start-backend.bat; keep only the 3-line safeFetch fix. | |
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ 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 mentions both api error toast suppression (main change in raw_summary) and backend startup (mentioned in PR objectives but not reflected in raw_summary of actual changes). |
| Linked Issues check | ✅ Passed | The safeFetch fix correctly addresses Issue #108's core requirement to respect silent flag for TypeError network errors, directly implementing the stated objective. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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 help to get the list of available commands and usage tips.
|
Thank you for the fix in src/lib/api.ts—that logic is exactly what we needed to silence the toast! However, I cannot merge this PR because your branch is severely out of sync and contains unrelated, destructive changes. Your commit is attempting to: Delete a critical ci.yml rate-limiting fix we just merged to main. |
|
Okay, I apologize for the messy commits and the accidental changes to ci.yml and README.md. I will check into it. |
c46b7ad to
d0676e2
Compare
|
I have rebased my branch onto the latest upstream/main and cleaned up the PR. All accidental changes to ci.yml, README.md, and the backend scripts have been removed. The PR now contains only the intended fix for suppressing silent error toasts in src/lib/api.ts. You can look into the FilesChanged Tab. Thank you |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Closes #108
This PR fixes Issue #108 by ensuring that network requests marked as silent do not trigger error toasts.
Also included an update to start-backend.bat to ensure a smoother local development experience.
Checklist
npm run lintpasses with no errorsnpm run buildcompiles without TypeScript errors.envfiles, API keys, secrets, model weights, or__pycache__in this diffSummary by CodeRabbit