Skip to content

add solution#1171

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

add solution#1171
ZhylaRoman wants to merge 2 commits into
mate-academy:masterfrom
ZhylaRoman:develop

Conversation

@ZhylaRoman
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

The implementation is missing critical functionality that blocks task completion. The debounce mechanism with a customizable delay prop (default 300ms) is completely absent - this is explicitly required by the task description where it states 'suggestions should appear after some delay in typing (debounce)' and 'the delay should be customizable via props'. Without this, the core feature isn't implemented. Additionally, there's a functional bug with the dropdown: using onBlur to close the dropdown and onMouseDown to select creates a race condition where the dropdown closes before selections can register, preventing users from actually selecting suggestions. To fix this, use onClick on suggestion items with e.preventDefault() in the blur handler, or restructure to use onMouseDown with proper event handling.


✨ 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 cypress.config.ts
Comment on lines 6 to 7
specPattern: 'cypress/integration/**/*.spec.{js,ts,jsx,tsx}',
},
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 is referenced but not implemented. Add a customizable delay prop with a default value of 300ms for the debounce functionality as required.

Comment thread src/App.tsx
Comment on lines +17 to +24
const filteredPeople = useMemo(() => {
if (!normalizedQuery) {
return peopleFromServer;
}

return peopleFromServer.filter(person =>
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.

Missing debounce implementation - The task explicitly requires: 'suggestions should appear after some delay in typing (debounce)' and 'the delay should be customizable via props (default value is 300ms)'. Currently, filtering happens immediately on each keystroke with no delay.

Comment thread src/App.tsx
Comment on lines +6 to +7
interface AppProps {
onSelected?: (person: Person) => void;
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 delay prop - The task requires 'the delay prop should be customizable via props (default value is 300ms)'. There's no delay prop defined in the AppProps interface.

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 is complete and correctly addresses all requirements. The debounce mechanism with customizable delay prop is properly implemented using useRef for the timer, and the dropdown selection race condition is resolved by using onMouseDown with event.preventDefault() to prevent the blur handler from closing the dropdown before selection registers. All checklist items are satisfied including proper handling of spaces-only input, stable keys from person.slug, and correct React event handler naming conventions. Great work!


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

Footnotes

  1. Rate AI review example

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