Skip to content

develop#1175

Open
fedechkova wants to merge 2 commits into
mate-academy:masterfrom
fedechkova:develop
Open

develop#1175
fedechkova wants to merge 2 commits into
mate-academy:masterfrom
fedechkova:develop

Conversation

@fedechkova
Copy link
Copy Markdown

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

This implementation has one critical blocker that violates an explicit checklist requirement: when the user enters only spaces, the filter runs with whitespace instead of returning all people as required by checklist item #1. The appliedQuery.trim() === '' check must be added to return all people before filtering. Additionally, the selection clearing in handleChange is too aggressive—onSelected(null) clears the selection on every keystroke, which prevents users from editing a selected person's name (e.g., adding a space). The selection should only clear when the input meaningfully differs from the selected person's name, not on every character input.


✨ 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 on lines +29 to +32
const visiblePeople = useMemo(() => {
return people.filter(person =>
person.name.toLowerCase().includes(appliedQuery.toLowerCase()),
);
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 violates checklist item #1: filter is called when user enters spaces only. The filter runs with whitespace (appliedQuery.toLowerCase().includes(' ')) instead of skipping the filter when input is only whitespace. Consider checking if appliedQuery.trim() is empty and returning all people in that case.

Comment thread src/components/Autocomplete.tsx Outdated
Comment on lines +35 to +38
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setQuery(event.target.value);
setIsOpen(true);
onSelected(null);
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 selection clearing is too aggressive. Currently onSelected(null) is called on every keystroke, which clears the selection even when the user just adds a space to the selected person's name. Per the requirements, selection should only be cleared when the input value changes meaningfully (e.g., user clears or modifies the name significantly). Consider only clearing when !query.startsWith(selectedPerson.name) to allow minor edits.

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 implementation is complete and all requirements are satisfied. The Autocomplete component correctly handles the spaces-only input case by returning all people when appliedQuery.trim() === '', and the selection clearing logic only triggers when the input meaningfully differs from the selected person's name, allowing users to edit names. All checklist items pass, including proper React usage without direct DOM manipulation, stable keys using person.slug, and correct event handler naming conventions. The h1 displays the selected person's birth-death dates appropriately, and all data-qa attributes are present for testing.


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

Footnotes

  1. Rate AI review example

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.

2 participants