Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution #1735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

solution #1735

wants to merge 1 commit into from

Conversation

Fridrif27
Copy link

Copy link

@taniabarkovskya taniabarkovskya 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, I`m approving this! 💪
but please pay attention to comments :)

return (
<tr
data-cy="person"
className={person.slug === slug ? 'has-background-warning' : ''}

Choose a reason for hiding this comment

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

you can try use classNames here, because you don't have second option

<td>
<Link
to={`${person.slug}`}
className={person.sex === 'f' ? 'has-text-danger' : ''}

Choose a reason for hiding this comment

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

you can try use classNames here, because you don't have second option

</td>
<td>
{person.father ? (
<Link to={person.father.slug}>{person.father.name}</Link>

Choose a reason for hiding this comment

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

you use here father.name but in previous line - motherName. I may be wrong, but I think it's better to use similar notation for these outputs

Comment on lines +22 to +28
if (mam) {
modifiedPerson.mother = mam;
}

if (dad) {
modifiedPerson.father = dad;
}

Choose a reason for hiding this comment

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

you can delete this because find will return undefined anyway

Copy link

@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.

Great job on implementing the task requirements! 🎉 While there are a few minor issues, such as the potential re-fetching logic in PeoplePage, the incorrect Link attribute for the father's name, and the nested route setup, these do not critically impact the core functionality. Keep up the good work, and consider addressing these points to enhance your code further. Happy coding! 🚀

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

Comment on lines +13 to +14
<Route path="people" element={<PeoplePage />}>
<Route path=":slug" element={<PeoplePage />} />

Choose a reason for hiding this comment

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

The nested route <Route path=":slug" element={<PeoplePage />} /> might cause unexpected behavior if PeoplePage is not designed to handle both the base path /people and the dynamic path /people/:slug. Consider verifying that PeoplePage can handle both cases or use a different component for the dynamic route if necessary.

</td>
<td>
{person.father ? (
<Link to={person.father.slug}>{person.father.name}</Link>

Choose a reason for hiding this comment

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

The Link component for the father's name uses person.father.name, but the to attribute should be person.father.slug to ensure correct navigation. Verify that person.father has a slug property and use it here.

const [isError, setIsError] = useState(false);

useEffect(() => {
if (!isError) {

Choose a reason for hiding this comment

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

The condition if (!isError) inside the useEffect hook might cause the fetch operation to be retried immediately after an error, due to the setIsError(false) call inside the catch block. Consider revising the logic to prevent unnecessary re-fetching, such as by using a separate state to control retries.

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