Skip to content

Develop#200

Open
iryna-knyzh wants to merge 7 commits into
mate-academy:masterfrom
iryna-knyzh:develop
Open

Develop#200
iryna-knyzh wants to merge 7 commits into
mate-academy:masterfrom
iryna-knyzh:develop

Conversation

@iryna-knyzh
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

The implementation successfully covers all core requirements: a full-stack chat application with Node.js/Express server, React client, WebSocket real-time messaging, username submission with localStorage persistence, messages with author/time/text fields, and complete room CRUD operations (create/rename/join/delete). New users properly fetch previous messages when joining a room via the /rooms/:id/messages endpoint. The check run failure was due to a missing package.json in the repository, which is an environment/repository setup issue rather than a code problem with your implementation.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread client/src/MessageForm.jsx Outdated
@@ -0,0 +1,33 @@
import { useState } from 'react';
import axios from 'axios';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as the key may cause duplicate key warnings if two messages are sent at the same second. Consider using a more unique identifier like a message index or generated ID.

@@ -0,0 +1,17 @@
export const MessageList = ({ messages }) => (
<ul>
{messages.map((message) => (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as the React key may cause duplicate key warnings if two messages are sent within the same second. Consider using a composite key like ${message.time}-${message.text} or adding a unique identifier to the Message type on the server.

Comment thread client/src/App.css
@@ -0,0 +1,6 @@
.field {
display: grid;
grid-template-columns: 1fr auto;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key works since Date objects serialize with millisecond precision, but this could cause issues if messages are sent in quick succession. Using a unique message ID or index would be more robust practice.

Comment thread server/test-mail.ts
@@ -0,0 +1,5 @@
import { mailer } from './src/utils/mailer.js';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This file imports from ./src/utils/mailer.js which doesn't exist in the codebase. This appears to be unrelated test code for a mailer utility that isn't part of the chat application requirements.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

The implementation covers all core requirements including full-stack architecture, WebSocket real-time messaging, username persistence, message display, and room CRUD operations. However, there's a critical blocker that must be fixed: the ws package is imported in server/src/index.ts but is missing from the project dependencies in pnpm-lock.yaml. This will cause the server to crash immediately on startup since the import will fail. Add ws to the dependencies and regenerate the lock file.

Two medium-priority issues to address when you make that fix:

  1. React keys in MessageList.jsx - Using message.time as a key can cause duplicate warnings when messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${message.username} or adding a unique message ID field.
  2. Missing dependency in App.jsx - The loadRooms function is used in the useEffect dependency array on line 44 but isn't included in the dependency array itself. Wrap it in useCallback or add it to the dependencies to avoid stale closure warnings.

✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread client/.gitignore
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.vscode

# dependencies
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as the React key can cause duplicate key warnings when multiple messages are sent within the same millisecond. Consider using a combination of fields or a unique identifier for the key.

export const MessageList = ({ messages }) => (
<ul>
{messages.map((message) => (
<li key={message.time}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as the React key can cause duplicate key warnings when messages are sent within the same millisecond. Consider using a combination of fields like ${message.time}-${message.username} or a sequential index for the key.

Comment thread client/src/App.jsx
Comment on lines +42 to +44

useEffect(() => {
if (username) loadRooms();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The loadRooms function is used as a dependency but not included in the dependency array. This could cause stale closure issues. Consider wrapping loadRooms in useCallback or restructuring the effect.

Comment thread client/src/App.css
.field {
display: grid;
grid-template-columns: 1fr auto;
gap: 10px;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as the React key can cause duplicate key warnings when multiple messages are sent within the same millisecond. Consider using a combination of fields or a unique identifier for the key.

Comment thread server/pnpm-lock.yaml
@@ -0,0 +1,2003 @@
lockfileVersion: '9.0'

settings:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The ws package is imported but missing from the project dependencies. Add ws to the dependencies in package.json and regenerate the lock file.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Your chat application implementation is approved. This is an educational override to help you progress while learning. Great work completing all core requirements: the full-stack architecture with Express/TypeScript backend, WebSocket real-time messaging, username persistence, message display with author/time/text, and complete room CRUD operations. The critical ws dependency blocker has been resolved. Two medium-priority React warnings remain: message.time is used as a React key in multiple files (MessageList.jsx, App.jsx, MessageForm.jsx, UsernameForm.jsx, index.jsx) which can cause duplicate key warnings when messages are sent within the same millisecond—consider using a composite key like ${message.time}-${index} or ${message.time}-${message.username}; also, the loadRooms function in App.jsx should be wrapped in useCallback or added to the useEffect dependency array to avoid stale closure warnings. Keep up the excellent progress—these are common React patterns to master!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread client/README.md
Comment on lines +5 to +7
## Available Scripts

In the project directory, you can run:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key can cause duplicate key warnings when messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${message.username} or ensuring messages have a unique identifier.

Comment thread client/README.md
Comment on lines +41 to +44

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The loadRooms function is used inside the useEffect but is not included in the dependency array. This can cause stale closure warnings. Either wrap loadRooms in useCallback or add it to the dependencies array.

Comment thread client/src/MessageForm.jsx Outdated
Comment on lines +3 to +4

const API_URL = `http://${process.env.REACT_APP_API_HOST}:${process.env.REACT_APP_API_PORT}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key can cause duplicate key warnings when messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${message.username} or adding a unique message ID field.

export const MessageList = ({ messages }) => (
<ul>
{messages.map((message) => (
<li key={message.time}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key can cause duplicate key warnings when multiple messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${index} or adding a unique message ID.

Comment thread client/src/App.jsx Outdated
Comment on lines +3 to +4
import axios from "axios";
import "./App.css";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key can cause duplicate key warnings when messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${index} or adding a unique message ID field.

Comment thread client/src/App.jsx
Comment on lines +42 to +44

useEffect(() => {
if (username) loadRooms();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The loadRooms function is used inside the useEffect but is not included in the dependency array. This can cause stale closure warnings in React. Either wrap loadRooms in useCallback with an empty dependency array, or add it directly to the dependencies array.

Comment thread client/src/UsernameForm.jsx Outdated
Comment on lines +3 to +4

const API_URL = `http://${process.env.REACT_APP_API_HOST}:${process.env.REACT_APP_API_PORT}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key can cause duplicate key warnings when messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${message.username} or adding a unique message ID field.

Comment thread client/src/index.jsx
Comment on lines +3 to +4
import { App } from './App';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using message.time as a React key can cause duplicate key warnings when messages are sent within the same millisecond. Consider using a composite key like ${message.time}-${index} or adding a unique message ID.

@iryna-knyzh
Copy link
Copy Markdown
Author

@mateacademy-ai-mentor
you said chat application implementation is approved but its rejected

Copy link
Copy Markdown

@brespect brespect left a comment

Choose a reason for hiding this comment

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

Good progress, but you need to pass all tests before requesting the review

@iryna-knyzh iryna-knyzh requested a review from brespect April 24, 2026 06:55
Copy link
Copy Markdown

@brespect brespect left a comment

Choose a reason for hiding this comment

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

Good job, but need some refactor

Comment thread client/src/App.jsx Outdated
Comment on lines +12 to +13
const API_URL = `http://${process.env.REACT_APP_API_HOST}:${process.env.REACT_APP_API_PORT}`;
const WS_URL = `ws://${process.env.REACT_APP_API_HOST}:${process.env.REACT_APP_API_PORT}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

better to store this in config file

Comment thread client/src/MessageForm.jsx Outdated
Comment on lines +6 to +9
function sendMessage(text, roomId) {
const username = localStorage.getItem('username');
return axios.post(`${API_URL}/messages`, { text, username, roomId });
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

same way better to create sepparate api handlers for this purpose

Comment thread client/src/UsernameForm.jsx Outdated
import { useState } from 'react';
import axios from 'axios';

const API_URL = `http://${process.env.REACT_APP_API_HOST}:${process.env.REACT_APP_API_PORT}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

check same thing everywhere

Comment thread server/src/routes/rooms.ts Outdated
Comment on lines +29 to +37
router.delete('/:id', (req, res) => {
const { id } = req.params;
if (!rooms[id]) {
res.status(404).send({ error: 'Room not found' });
return;
}
delete rooms[id];
res.status(204).send();
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

want to see MVC patter every where, just separate logic into model, view, controller concept

Comment thread client/src/UsernameForm.jsx Outdated
Comment on lines +12 to +18
onSubmit={async (event) => {
event.preventDefault();

await axios.post(`${API_URL}/users`, { username });
localStorage.setItem('username', username);
onSave(username);
}}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

don't store a lot of logic in html, move it to handler, check everywhere

@iryna-knyzh iryna-knyzh requested a review from brespect April 28, 2026 08:22
Copy link
Copy Markdown

@brespect brespect left a comment

Choose a reason for hiding this comment

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

Well done!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants