Skip to content

add solution#1180

Open
ratseburzhynskyi wants to merge 2 commits into
mate-academy:masterfrom
ratseburzhynskyi:develop
Open

add solution#1180
ratseburzhynskyi wants to merge 2 commits into
mate-academy:masterfrom
ratseburzhynskyi:develop

Conversation

@ratseburzhynskyi
Copy link
Copy Markdown

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

Your implementation has two critical missing features that violate explicit task requirements. First, you need to add an onSelected callback prop that receives the selected person when the user clicks on a suggestion - this is a required feature per the task description. Second, the debounce delay must be customizable via props with a 300ms default value, but it's currently hardcoded to 300ms in applyDebounce. To fix this: add onSelected?: (person: Person) => void prop and call it in the click handler, and add delay?: number prop (default 300) using it instead of the hardcoded value. These are blocking issues that will cause test failures.


✨ 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 thread src/App.tsx Outdated
Comment on lines +8 to +9
export const App: React.FC = () => {
const { name, born, died } = peopleFromServer[0];
const [query, setQuery] = useState('');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing required onSelected callback prop. The task requires passing the selected person to the onSelected callback passed via props, but this prop is not defined.

Comment thread src/App.tsx Outdated
Comment on lines +24 to +27
const applyDebounce = useMemo(() => {
return debounce((value: string) => {
setDebouncedQuery(value);
}, 300);
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 delay prop for debounce is missing. The task requires the delay to be customizable via props with a default value of 300ms, but applyDebounce is hardcoded to 300ms.

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

The implementation meets all functional requirements and the identified issues are optimization opportunities rather than functional blockers.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment thread src/App.tsx
Comment on lines +28 to +32

const applyDebounce = useMemo(() => {
return debounce((value: string) => {
setDebouncedQuery(value);
}, delay);
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 useMemo for applyDebounce has an empty dependency array but uses delay in its factory function. If delay prop changes, this won't recreate the debounce. Either include delay in the dependency array or use a different pattern.

Comment thread src/App.tsx
Comment on lines +20 to +26

let filteredPeople = peopleFromServer;

if (normalizedQuery) {
filteredPeople = peopleFromServer.filter(person => {
return person.name.toLowerCase().includes(normalizedQuery);
});
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 filteredPeople computation runs on every render without memoization. Consider using useMemo since it depends on debouncedQuery and the filtering operation could be expensive.

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.

2 participants