Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This is a very strong submission, and the code is well-structured. However, a critical integration test is failing, which needs to be fixed. The test Page > user interactions > should update the title after another person is selected fails because the suggestion list does not reappear after a person has already been selected.
This is likely a state management issue in your Autocomplete component. When a user selects a person, and then clicks back into the input to change their selection, the suggestion list should be displayed again. Please adjust your component's logic to ensure the suggestions are shown on focus or input change, regardless of whether an item was previously selected.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because there's a critical issue with the filtering logic in your Autocomplete component.
Great job fixing the previous issue where the suggestion list wouldn't reappear! However, the new implementation now shows the entire list of people instead of a filtered list after you stop typing. This happens because of the condition debouncedQuery === query in your useMemo hook. When the debounce timer finishes, debouncedQuery becomes equal to query, causing your code to return the full, unfiltered people array.
To fix this, please remove the debouncedQuery === query check. The logic should only return the full list when the search query is empty. This will ensure the suggestions are correctly filtered based on the user's 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
| return []; | ||
| } | ||
|
|
||
| if (!normalizedQuery || debouncedQuery === query) { |
There was a problem hiding this comment.
This condition, debouncedQuery === query, causes incorrect filtering. When the user stops typing, debouncedQuery becomes equal to query. This is the exact moment you should show the filtered list based on the user's input. However, this logic causes the full, unfiltered people array to be returned instead.
The condition should only check if normalizedQuery is empty to decide whether to show the full list. Please remove the debouncedQuery === query check.
This change will also allow you to remove query from the useMemo dependency array on line 45, as the suggestions should only depend on the debounced query value.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job addressing the filtering logic from the previous review! Your solution is very close to complete, and I am approving it so you can move forward.
There is one key issue remaining in src/components/Autocomplete/Autocomplete.tsx. When a user selects a person and then clicks back into the input field, the input text is cleared, but the selected person in the h1 title is not. This creates an inconsistent UI state and goes against the requirement to clear the selection when the input value changes.
To fix this, take a look at your onFocus handler. Along with clearing the query, you also need to call onSelected(null) to reset the selection in the parent component. You're doing great work, keep it up!
✨ 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
| onFocus={() => { | ||
| setIsFocused(true); | ||
| setQuery(''); |
There was a problem hiding this comment.
When the input is focused, its value is cleared. This change in value should also clear the currently selected person in the App component to meet the requirement: when the selected person is displayed in the title, but the value in the input changes, the selected person should be cleared....
Currently, only setQuery is called, but the onSelected(null) callback is missed. Consider how you can reuse your handleChange function here to both update the query and notify the parent component.
brespect
left a comment
There was a problem hiding this comment.
Good progress, but you need to pass tests before submit
Co-authored-by: Denys Semtso <70220667+etojeDenys@users.noreply.github.com>

No description provided.