Repository navigation
added solution - #1268
added solution#1268KristinaMelnyk wants to merge 2 commits into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Changes are needed in src/components/Autocomplete.tsx to meet two explicit requirements. When the debounced query contains only spaces, normalization produces an empty query and the component still filters the people list; skip filtering for whitespace-only input while preserving suggestions for a genuinely empty, focused input. The input and suggestion elements use data-cy instead of the required data-qa attributes, so tests looking for the required selectors may not find them; provide the required data-qa attributes on those elements. The debounce, selection, and dropdown behavior otherwise appear to cover the main autocomplete flow.
✨ 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
| const normalizedQuery = appliedQuery.trim().toLowerCase(); | ||
|
|
||
| const filteredPeople = useMemo( | ||
| () => | ||
| people.filter(person => | ||
| person.name.toLowerCase().includes(normalizedQuery), |
There was a problem hiding this comment.
This violates checklist item 1: “make sure that filter won't be called if user enred spaces only;” When the debounced query consists of spaces, normalizedQuery becomes empty and this still filters every person. Skip filtering for whitespace-only input while retaining the required empty-input suggestions behavior.
| type="text" | ||
| placeholder="Enter a part of the name" | ||
| className="input" | ||
| data-cy="search-input" |
There was a problem hiding this comment.
The required test attributes are data-qa, but this component uses data-cy here and on the suggestion list/items. Preserve or provide the required data-qa attributes so the tests can locate these elements.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The reviewed implementation meets the autocomplete and title-display requirements, including debounced filtering, empty-input suggestions, selection handling, and clearing the selection when the input changes. The required data-qa attributes and checklist items for whitespace-only queries, avoiding direct DOM interaction, suggestion keys, and callback naming are also addressed. Editor setup, external guidelines, and the PR demo link could not be verified from the reviewed files, but no blocking code issues were identified.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.