Repository navigation
resolved 1.0.0 - #1270
resolved 1.0.0#1270ptrodion wants to merge 3 commits into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The core autocomplete flow is in place, including debouncing, selection, and the selected-person title, but several explicit requirements still need attention. In src/components/Autocomplete/Autocomplete.tsx, clearing the input can keep showing results for the previous query until the debounce completes; use the current input value to show all people immediately when it is empty. The component uses data-cy instead of the required data-qa attributes, and its suggestion keys use array indexes rather than stable person identifiers (checklist item 3). In src/App.tsx, move the autocomplete outside the h1 so the heading contains only the selected-person title. Addressing these points will bring the implementation in line with the stated behavior and checklist.
✨ 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
| <h1 className="title" data-cy="title"> | ||
| {`${name} (${born} - ${died})`} | ||
| {titleText} | ||
| <Autocomplete | ||
| people={peopleFromServer} | ||
| delay={300} | ||
| onSelected={setSelectedPerson} | ||
| /> |
There was a problem hiding this comment.
Keep the autocomplete outside the h1; as written, the heading includes the input and dropdown, rather than containing only the selected-person title required by the task.
| }, [applyQuery]); | ||
|
|
||
| const filteredPeople = useMemo(() => { | ||
| const normalizedQuery = appliedQuery.trim().toLowerCase(); |
There was a problem hiding this comment.
When the input is cleared while appliedQuery still contains the previous text, this memo continues to return the old filtered results until the debounce expires. The task requires showing all people whenever the focused input is empty; use the current input value to make that happen immediately.
| <div className="dropdown-content"> | ||
| {filteredPeople.map((person: Person, index: number) => ( | ||
| <div | ||
| key={index} |
There was a problem hiding this comment.
This uses the array index as the key, which can change when the filtered list changes. This violates checklist item 3: “don't generate key on render”; use a stable identifier for each person instead.
| type="text" | ||
| placeholder="Enter a part of the name" | ||
| className="input" | ||
| data-cy="search-input" |
There was a problem hiding this comment.
The task requires preserving the data-qa attributes, but this input uses data-cy instead. Ensure the required test attribute is present so tests that select by data-qa can find it.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The autocomplete and App changes meet the reviewed functional requirements, including debouncing, selection behavior, and the required heading and attributes. One blocker remains in .eslintrc.cjs: a misspelled ESLint rule name can cause linting to fail because ESLint cannot resolve the rule. Correct the rule key to the intended valid ESLint rule identifier, then rerun linting to verify the configuration. The reviewed summaries do not provide a line number, so I can only point to the configuration file. The rest of the implementation looks solid.
✨ 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
Your implementation handles selection, empty and whitespace-only input, stable suggestion keys, and the selected-person title correctly. One functional issue remains in src/components/Autocomplete/Autocomplete.tsx: after a query has been applied, the suggestions can be recomputed from the previous appliedQuery as soon as the input changes, showing stale results before the debounce finishes. Ensure filtering and displayed suggestions update only once the current input query has been applied; the review context does not provide line numbers for this issue. I am approving this as an educational override to help you progress while learning, and you have a solid foundation to build on.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| const normalizedQuery = appliedQuery.trim().toLowerCase(); | ||
|
|
||
| if (!normalizedQuery) { | ||
| return people; | ||
| } | ||
|
|
||
| return people.filter(person => |
There was a problem hiding this comment.
After a query has been applied, each subsequent keystroke changes query and recomputes this memo immediately using the previous appliedQuery. That both runs the filter before the debounce delay and temporarily shows results for stale text; ensure filtering and displayed suggestions wait for the current query to be applied.
No description provided.