Conversation
WalkthroughThe pull request adds two optional props, Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/components/autocompletes/common/autocompleteMenu/autocompleteMenu.tsx`:
- Around line 65-69: The current slice of props.options using optionsLimit
happens before AutocompleteOptions does its internal filtering, which can
prevent matches outside the first optionsLimit; remove the pre-filter slice here
and instead apply the limit after filtering (ideally inside AutocompleteOptions
by capping the computed availableOptions to optionsLimit), or if you prefer
minimal change, pass optionsLimit through and have AutocompleteOptions apply the
slice after it computes availableOptions; update references in
AutocompleteOptions (e.g., availableOptions) to enforce the limit.
- Around line 70-71: The limitation message currently renders whenever there are
any options because the condition only checks props?.options?.length >
optionsLimit; change the JSX condition to also require optionsLimit > 0
(matching the check used on line 68) so the message only appears when a limit is
active, and replace the invalid <p> inside the <ul> with an <li
aria-hidden="true" className={cx('limitation-item')}> to keep valid list markup;
update the conditional rendering around limitationText and optionsLimit in the
autocompleteMenu JSX (look for optionsLimit, limitationText, and props?.options)
accordingly.
🧹 Nitpick comments (1)
src/components/autocompletes/common/autocompleteMenu/autocompleteMenu.module.scss (1)
45-56: Remove thecursor: pointeron a non-interactive item.With
pointer-events: none, the element won’t be interactive;cursor: pointeris misleading. Consider dropping it to match behavior.
src/components/autocompletes/common/autocompleteMenu/autocompleteMenu.tsx
Outdated
Show resolved
Hide resolved
src/components/autocompletes/common/autocompleteMenu/autocompleteMenu.tsx
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/autocompletes/common/autocompleteOptions.tsx`:
- Around line 70-71: The default optionsLimit of 1 causes the limitation message
to appear whenever availableOptions.length > 1; change optionsLimit to be opt-in
(remove the numeric default or set it to undefined/Infinity) and update the
render condition to check that optionsLimit is set before comparing (e.g.,
optionsLimit != null && availableOptions.length > optionsLimit) so
limitationText only shows when the consumer explicitly provides optionsLimit and
limitationText; adjust the prop default/typing where optionsLimit and
limitationText are declared in autocompleteOptions.tsx accordingly.
🧹 Nitpick comments (1)
src/components/autocompletes/common/autocompleteOptions.tsx (1)
166-168: The options list is not actually truncated — only a message is shown.The prop name
optionsLimitimplies the displayed options will be capped at that number, but allavailableOptionsare still rendered viarenderItems(availableOptions)on line 165. If the intent is to both limit and inform, consider slicing the rendered list:Optional: slice the rendered options
- {!isEmpty(availableOptions) ? renderItems(availableOptions) : renderEmptyList()} - {availableOptions?.length > optionsLimit && limitationText ? ( + {!isEmpty(availableOptions) + ? renderItems(optionsLimit ? availableOptions.slice(0, optionsLimit) : availableOptions) + : renderEmptyList()} + {optionsLimit && availableOptions?.length > optionsLimit && limitationText ? (If the message-only behavior is intentional (e.g., the backend already limits results), consider renaming the prop to something like
optionsCountThresholdto better communicate that it's a display threshold, not a cap.
…limit-options-for-autocomplete Feature/add possibility to limit options for autocomplete d8eb029
Screen.Recording.2026-02-04.at.00.43.23.mov
Summary by CodeRabbit