fix: code quality and safety improvements - #753
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe server now uses ChangesCORS validation
Activity feed response handling
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There 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/components/ActivityFeed.tsx`:
- Around line 36-37: Update the ActivityFeed request flow to track a distinct
error state when the response is not OK or parsing fails, and clear it on
successful fetches. Render the error state instead of “No activity found” or
stale events after failures, and add coverage for both initial-load and
interval-fetch failures.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3deb0998-b9e4-4372-8e84-2c70c1662b84
📒 Files selected for processing (2)
backend/server.jssrc/components/ActivityFeed.tsx
| if (!res.ok) throw new Error("Request failed"); | ||
| const data = await res.json(); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Show an error state for failed responses.
When res.ok is false, the catch block only stops loading. The UI then shows No activity found on the initial request, or silently displays stale events during a refresh. Add an error state and render it instead of treating a failed request as an empty successful response. Add tests for both initial and interval-fetch failures.
🤖 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/components/ActivityFeed.tsx` around lines 36 - 37, Update the
ActivityFeed request flow to track a distinct error state when the response is
not OK or parsing fails, and clear it on successful fetches. Render the error
state instead of “No activity found” or stale events after failures, and add
coverage for both initial-load and interval-fetch failures.
Summary by CodeRabbit