Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
You've done a great job implementing the core functionality here—the debouncing and filtering logic work really well! However, I am requesting changes because the main goal was to create a reusable Autocomplete component, but all the logic is currently implemented inside the App component. This prevents it from being reusable and has led to a couple of key requirements being missed:
- The debounce
delayis hardcoded insrc/App.tsx. It should be a customizable prop with a default value of 300ms. - When a user makes a selection, the chosen person object isn't passed to an
onSelectedcallback prop as required.
To resolve this, please refactor the logic into a separate Autocomplete component. The App component should then use this new component, configuring it with props like delay and onSelected.
✨ 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
src/App.tsx
Outdated
| import { peopleFromServer } from './data/people'; | ||
| import { Person } from './types/Person'; | ||
|
|
||
| const DEBOUNCE_DELAY = 300; |
There was a problem hiding this comment.
The debounce delay is hardcoded here. According to the task requirements, the delay should be a customizable prop for the Autocomplete component, with a default value of 300ms.
src/App.tsx
Outdated
| const handleSelect = (person: Person) => { | ||
| setQuery(person.name); | ||
| setSelectedPerson(person); | ||
| setIsOpen(false); |
There was a problem hiding this comment.
This handler correctly updates the internal state. However, the task requires passing the selected person object to an onSelected callback function that should be passed to the component via props. This is a key requirement for making the component reusable.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this iteration! I am approving your solution. You've done a fantastic job refactoring the logic into a reusable Autocomplete component and have successfully addressed all the feedback from the previous review. The component is well-structured, and the application now fully meets all specified requirements. Great job!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
DEMO LINK