Skip to content

added solution - #1268

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

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

Conversation

@KristinaMelnyk

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

  1. Rate AI review example ↩

  2. Re-request AI review example ↩

  3. Add AI review comments example ↩

Comment thread src/components/Autocomplete.tsx Outdated
Comment on lines +24 to +29
const normalizedQuery = appliedQuery.trim().toLowerCase();

const filteredPeople = useMemo(
() =>
people.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.

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"

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 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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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! ✨

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