Repository navigation
Conversation
- Removed unused dependencies from package.json and package-lock.json. - Updated react-router and daisyui versions in frontend dependencies. - Enhanced ActiveTabSwitch, ChatsList, and ContactList components for improved functionality and user experience. - Added new components: NoChatsFound and UsersLoadingSkeleton for better loading states. - Implemented profile image upload functionality in ProfileHeader. - Adjusted layout and styling in ChatPage and LoginPage for better responsiveness.
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR replaces placeholder chat, contact, tab, empty-state, loading, and profile components with store-backed interfaces. It adds profile updates, adjusts page layouts and sound initialization, and changes dependency declarations. ChangesChat and profile UI
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant ProfileHeader
participant FileReader
participant useAuthStore
User->>ProfileHeader: Select profile image
ProfileHeader->>FileReader: Read image as data URL
FileReader-->>ProfileHeader: Return image data
ProfileHeader->>useAuthStore: updateProfile({ profilePic })
useAuthStore-->>ProfileHeader: Update authUser
Possibly related PRs
🚥 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 |
| onClick={() => setSelectedUser(contact)} | ||
| > | ||
| <div className="flex items-center gap-3"> | ||
| <div className={`avatar ${onlineUsers.includes(contact._id) ? "online" : "offline"}`}> |
There was a problem hiding this comment.
🔴 Contacts list crashes when any contacts exist
The online status check reads a contact list from the auth store that does not exist (onlineUsers.includes(contact._id) at frontend/src/components/ContactList.jsx:26), so once there is at least one contact to display the component tries to call a method on an undefined value and the screen crashes.
Impact: When the contacts tab loads any contacts, it throws an error and fails to render.
Missing onlineUsers in useAuthStore
frontend/src/components/ContactList.jsx:9 destructures const { onlineUsers } = useAuthStore();, but useAuthStore (frontend/src/store/useAuthStore.js:6-74) never defines onlineUsers. So onlineUsers is undefined and onlineUsers.includes(contact._id) at line 26 throws TypeError during render whenever allContacts is non-empty.
Prompt for agents
The ContactList component reads onlineUsers from useAuthStore, but useAuthStore (frontend/src/store/useAuthStore.js) never defines onlineUsers, so onlineUsers.includes(contact._id) throws a TypeError when contacts render. Either add an onlineUsers state array to useAuthStore (populated via socket), or guard the access, e.g. (onlineUsers || []).includes(contact._id). The same issue exists in ChatsList.jsx.
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
frontend/src/components/ProfileHeader.jsx (1)
7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptionally guard
Audioinitialization for non-browser environments.Initializing
new Audio()at the module level will throw aReferenceErrorif this file is imported in a non-browser environment, such as during server-side rendering (SSR) or when running unit tests with tools like Jest or Vitest.Consider guarding it to improve testability and resilience.
♻️ Proposed fix
-const mouseClickSound = new Audio("/sounds/mouse-click.mp3"); +const mouseClickSound = typeof Audio !== "undefined" ? new Audio("/sounds/mouse-click.mp3") : null;You will also need to safely play the audio on line 84:
- mouseClickSound.currentTime = 0; // reset to start - mouseClickSound.play().catch((error) => console.log("Audio play failed:", error)); + if (mouseClickSound) { + mouseClickSound.currentTime = 0; + mouseClickSound.play().catch((error) => console.log("Audio play failed:", error)); + }🤖 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 `@frontend/src/components/ProfileHeader.jsx` at line 7, Guard the module-level mouseClickSound initialization in ProfileHeader so Audio is only constructed when the browser Audio API is available, avoiding SSR and test-environment ReferenceError failures. Update the audio playback logic in the component’s click handler to safely handle the absent sound instance before calling its play method.
🤖 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 `@frontend/package.json`:
- Around line 19-20: Align the router dependencies in frontend/package.json on
one supported major: either downgrade react-router to v7 to match
react-router-dom, or complete the v8 migration by removing react-router-dom,
updating BrowserRouter and Link imports to the v8 packages, and upgrading
react/react-dom and Node to v8 minimum versions.
In `@frontend/src/components/ChatsList.jsx`:
- Line 28: Initialize onlineUsers to an empty array in useAuthStore.js,
preserving the existing includes() calls in both
frontend/src/components/ChatsList.jsx#L28 and
frontend/src/components/ContactList.jsx#L26; no direct changes are required at
those call sites.
In `@frontend/src/components/ContactList.jsx`:
- Line 28: Add an alt attribute to the avatar img element in ContactList, using
the contact’s name as descriptive alternative text while preserving the existing
profilePic fallback.
In `@frontend/src/components/ProfileHeader.jsx`:
- Around line 41-62: Update ProfileHeader’s render expressions to optional-chain
authUser before accessing profilePic and fullName, preserving the existing
fallback avatar and username behavior while preventing a null dereference during
logout.
In `@frontend/src/pages/ChatPage.jsx`:
- Around line 19-34: Restore mobile responsive visibility in the sidebar and
chat-container wrappers: hide the sidebar when selectedUser is set and hide the
chat container when no user is selected on mobile viewports, while preserving
both panels’ desktop visibility and the existing ChatsList, ContactList,
ChatContainer, and NoConversationPlaceholder rendering.
In `@frontend/src/store/useAuthStore.js`:
- Line 71: Update the error toast handling in the relevant authentication action
to safely access the response message when error.response is absent, using
optional chaining and the store’s established fallback message pattern. Preserve
the existing server-provided message when available and ensure network errors
still display a toast without throwing.
In `@frontend/src/store/useChatStore.js`:
- Line 15: Update the isSoundEnabled initialization to compare the raw
localStorage value directly with the string "true"; remove JSON.parse so
persisted sound settings initialize correctly.
---
Nitpick comments:
In `@frontend/src/components/ProfileHeader.jsx`:
- Line 7: Guard the module-level mouseClickSound initialization in ProfileHeader
so Audio is only constructed when the browser Audio API is available, avoiding
SSR and test-environment ReferenceError failures. Update the audio playback
logic in the component’s click handler to safely handle the absent sound
instance before calling its play method.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
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
Run ID: 97c42a23-163e-47e2-a5ff-d109993b69c3
⛔ Files ignored due to path filters (9)
frontend/package-lock.jsonis excluded by!**/package-lock.jsonfrontend/public/avatar.pngis excluded by!**/*.pngfrontend/public/sounds/keystroke1.mp3is excluded by!**/*.mp3frontend/public/sounds/keystroke2.mp3is excluded by!**/*.mp3frontend/public/sounds/keystroke3.mp3is excluded by!**/*.mp3frontend/public/sounds/keystroke4.mp3is excluded by!**/*.mp3frontend/public/sounds/mouse-click.mp3is excluded by!**/*.mp3frontend/public/sounds/notification.mp3is excluded by!**/*.mp3package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (13)
frontend/package.jsonfrontend/src/components/ActiveTabSwitch.jsxfrontend/src/components/ChatsList.jsxfrontend/src/components/ContactList.jsxfrontend/src/components/NoChatsFound.jsxfrontend/src/components/ProfileHeader.jsxfrontend/src/components/UsersLoadingSkeleton.jsxfrontend/src/pages/ChatPage.jsxfrontend/src/pages/LoginPage.jsxfrontend/src/pages/RegisterPage.jsxfrontend/src/store/useAuthStore.jsfrontend/src/store/useChatStore.jspackage.json
💤 Files with no reviewable changes (1)
- package.json
| "react-router": "^8.2.0", | ||
| "react-router-dom": "^7.18.1", |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== package.json =="
sed -n '1,120p' frontend/package.json
echo
echo "== routing imports =="
rg -n --hidden --glob '!**/node_modules/**' 'react-router-dom|react-router/dom|react-router\b' frontend/src frontend | sed -n '1,200p'Repository: hemjaygfx/NexTalk
Length of output: 2720
🌐 Web query:
React Router v8 react-router-dom removed DOM APIs react-router/dom minimum React and Node versions upgrade guide
💡 Result:
React Router v8 marks the official removal of the react-router-dom package, which was previously maintained as a convenience wrapper to support transitions from v6 to v7 [1][2][3]. Upgrade Requirements React Router v8 requires the following minimum versions [4][5]: - Node.js: 22.22.0 or higher [4][5] - React: 19.2.7 or higher (includes react and react-dom) [4][5] - Vite: 7.0.0 or higher [5] Updating Imports Because the react-router-dom package has been removed, you must update your import statements to point directly to the main packages [4][6]: - For DOM-specific APIs (such as RouterProvider or HydratedRouter), import from react-router/dom [4][3]. - For all other APIs, import directly from react-router [4][3]. Example migration: // Before import { Link, useLocation, RouterProvider } from "react-router-dom"; // After import { Link, useLocation } from "react-router"; import { RouterProvider } from "react-router/dom"; It is recommended to adopt these import changes while still on v7 to facilitate a smoother transition to v8 [4]. You can safely uninstall the react-router-dom package after updating your code [4][2].
Citations:
- 1: https://reactrouter.com/main/changelog
- 2: https://remix.run/blog/react-router-v8
- 3: Release v8.0.0 remix-run/react-router#15198
- 4: https://reactrouter.com/upgrading/v7
- 5: https://reactrouter.com/changelog
- 6: https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md
Keep the router packages on one major
react-routeris on8.2.0, butreact-router-domis still7.18.1, and the app still importsBrowserRouter/Linkfromreact-router-dom.react/react-domare19.2.6, below React Router v8’s minimum19.2.7.
Either stay on v7 for now or finish the v8 migration by removing react-router-dom, switching the imports to react-router/react-router/dom, and bumping React (and Node) to v8’s minimums.
🤖 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 `@frontend/package.json` around lines 19 - 20, Align the router dependencies in
frontend/package.json on one supported major: either downgrade react-router to
v7 to match react-router-dom, or complete the v8 migration by removing
react-router-dom, updating BrowserRouter and Link imports to the v8 packages,
and upgrading react/react-dom and Node to v8 minimum versions.
| onClick={() => setSelectedUser(chat)} | ||
| > | ||
| <div className="flex items-center gap-3"> | ||
| <div className={`avatar ${onlineUsers.includes(chat._id) ? "online" : "offline"}`}> |
There was a problem hiding this comment.
🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find which store defines and manages the `onlineUsers` state.
rg 'onlineUsers' frontend/src/store/Repository: hemjaygfx/NexTalk
Length of output: 155
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== useAuthStore references ==\n'
rg -n 'useAuthStore|onlineUsers' frontend/src -g '!**/node_modules/**' || true
printf '\n== store files ==\n'
git ls-files frontend/src/store frontend/src | rg 'store|auth|socket|chat|contact'
printf '\n== relevant component excerpts ==\n'
sed -n '1,120p' frontend/src/components/ChatsList.jsx
printf '\n---\n'
sed -n '1,120p' frontend/src/components/ContactList.jsx
printf '\n---\n'
sed -n '1,220p' frontend/src/store/useAuthStore.js 2>/dev/null || true
printf '\n---\n'
sed -n '1,220p' frontend/src/store/authStore.js 2>/dev/null || true
printf '\n---\n'
sed -n '1,220p' frontend/src/store/useSocketStore.js 2>/dev/null || true
printf '\n---\n'
sed -n '1,220p' frontend/src/store/socketStore.js 2>/dev/null || trueRepository: hemjaygfx/NexTalk
Length of output: 6361
Initialize onlineUsers before calling .includes()
frontend/src/store/useAuthStore.js doesn’t define onlineUsers, so both ChatsList and ContactList can crash on render when they call .includes() on undefined. Add onlineUsers: [] to the store or guard both call sites:
frontend/src/components/ChatsList.jsx#L28frontend/src/components/ContactList.jsx#L26
🧰 Tools
🪛 ast-grep (0.44.1)
[warning] 28-30: A list component should have a key to prevent re-rendering
Context:
<img src={chat.profilePic || "/avatar.png"} alt={chat.fullName} />
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.
(list-component-needs-key)
📍 Affects 2 files
frontend/src/components/ChatsList.jsx#L28-L28(this comment)frontend/src/components/ContactList.jsx#L26-L26
🤖 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 `@frontend/src/components/ChatsList.jsx` at line 28, Initialize onlineUsers to
an empty array in useAuthStore.js, preserving the existing includes() calls in
both frontend/src/components/ChatsList.jsx#L28 and
frontend/src/components/ContactList.jsx#L26; no direct changes are required at
those call sites.
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. The branch was updated while autofix was in progress. Please try again. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
UI Improvements
Bug Fixes