Skip to content

add task solution#1145

Open
24O07 wants to merge 5 commits intomate-academy:masterfrom
24O07:develop
Open

add task solution#1145
24O07 wants to merge 5 commits intomate-academy:masterfrom
24O07:develop

Conversation

@24O07
Copy link
Copy Markdown

@24O07 24O07 commented Mar 31, 2026

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 solid implementation, and you've done a great job meeting most of the requirements. The component is well-structured and the debouncing logic is correct. However, I'm requesting a small change to the filtering logic in src/components/Auto.tsx. Currently, the filter is triggered even if the user enters only spaces, which goes against the requirements [CHECKLIST ITEM #1]. To resolve this, please ensure you trim() the input value and only perform the filtering if the resulting string is not empty. This will make the component's behavior more robust and align with the task's checklist. Keep up the great work!


✨ 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 +24 to +32
if (inputValue === '') {
setSuggestions(data);
} else {
const filtered = data.filter(person =>
person.name.toLowerCase().includes(inputValue.toLowerCase()),
);

setSuggestions(filtered);
}
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 filtering logic doesn't account for inputs that contain only whitespace. This violates checklist item #1: 'make sure that filter won't be called if user enred spaces only;'.

Additionally, the inputValue is not trimmed before being used for filtering, which means that leading or trailing spaces will affect the search results (e.g., searching for " Ada " instead of "Ada").

You should trim the inputValue and only proceed with filtering if the result is not an empty string.

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 on the progress so far! You've correctly implemented the debouncing and state management. However, I'm requesting changes for a couple of issues that affect the core functionality.

  1. Incorrect Filtering with Whitespace: The filter logic currently uses the raw inputValue, which includes spaces. This means a search for " Luke " won't find "Luke Skywalker". Please use the trimmedValue for the search. Also, an input containing only spaces incorrectly shows all suggestions instead of none, which violates a requirement [CHECKLIST ITEM #1].
  2. Dropdown Opens on Page Load: The suggestions dropdown appears automatically on the initial render without any user interaction. The requirement states that it should only open when the input is focused. The onFocus handler already takes care of this, so the effect causing it to open on load needs to be adjusted.

Once these are fixed, your component will be perfect. Keep up the great work!


✨ 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

setSuggestions(data);
} else {
const filtered = data.filter(person =>
person.name.toLowerCase().includes(inputValue.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.

The filter logic here uses inputValue, which includes leading/trailing whitespace. This will likely cause searches to fail (e.g., searching for " Luke " won't find "Luke Skywalker"). You should use trimmedValue for the search, which you've already calculated on line 24.

setSuggestions(filtered);
}

setDropdownActive(true);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Calling setDropdownActive(true) here causes the dropdown to open on the initial render without any user interaction. The requirement states that the list should appear "when input is focused". The onFocus handler already opens the dropdown, so this line may be unnecessary.

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 approving this solution as an educational override to help you progress, but there is one key requirement that still needs to be addressed.

Great job fixing the previous issues with debouncing and whitespace handling! The component is much more robust now. The main issue remaining is that the suggestions list doesn't appear when the input is focused but empty. The current logic hides the dropdown when the input value is empty, which prevents the list of all people from showing up as required. This is also why the automated tests are failing—they can't find the dropdown menu to interact with.

To fix this, consider managing the dropdown's visibility with a dedicated state variable (e.g., isDropdownOpen). You can set this state to true on focus and use it to conditionally add the is-active class to the Bulma dropdown container. This will give you more direct control over when the dropdown appears.

Keep up the excellent work!


✨ 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 +26 to +29
if (trimmedValue === '') {
// якщо інпут порожній або тільки пробіли — не показуємо підказок
setSuggestions([]);
setDropdownActive(false); // закриваємо dropdown
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 logic hides the dropdown when the input becomes empty. This causes an issue when a user types something and then clears the input field. Even if the input is still focused, the suggestion list disappears. The expected behavior is for the list to show all people again, as per the requirement for an empty, focused input.

Comment on lines +70 to +77
if (trimmedValue !== '') {
setDropdownActive(true);
setSuggestions(
data.filter(person =>
person.name.toLowerCase().includes(trimmedValue.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 condition prevents suggestions from appearing when the input is focused while empty. According to the requirements, the component should 'show the list of all people when input is focused but empty'. This logic needs to be adjusted to handle the case where trimmedValue is empty and show all suggestions from the data prop.

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.

demo link does not work. please fix it and re-request the review. also, make sure you pass all the tests

@24O07 24O07 requested a review from etojeDenys April 1, 2026 11:15
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.

DEMO link is not fixed yet, please run npm run deploy

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.

4 participants