Skip to content

add solution#1146

Open
Vasyl-Levytskiy wants to merge 6 commits intomate-academy:masterfrom
Vasyl-Levytskiy:develop
Open

add solution#1146
Vasyl-Levytskiy wants to merge 6 commits intomate-academy:masterfrom
Vasyl-Levytskiy:develop

Conversation

@Vasyl-Levytskiy
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

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

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

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

return [];
}

if (!normalizedQuery || debouncedQuery === query) {
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 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.

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

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment on lines +77 to +79
onFocus={() => {
setIsFocused(true);
setQuery('');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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 tests before submit

@Vasyl-Levytskiy Vasyl-Levytskiy requested a review from brespect April 2, 2026 07:48
Copy link
Copy Markdown

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

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

almost done

  1. provide a demo link and re-request the review

  2. fix the last test

Image

Co-authored-by: Denys Semtso <70220667+etojeDenys@users.noreply.github.com>
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.

Tests still not fixed.

@Vasyl-Levytskiy Vasyl-Levytskiy requested a review from brespect April 2, 2026 12:17
Copy link
Copy Markdown

@Anton-Kuchmasov Anton-Kuchmasov left a comment

Choose a reason for hiding this comment

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

Please fix your solution to pass ALL tests and then re-request review again

Image

If you're stuck, feel free to ask help in fe_chat

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.

5 participants