-
Notifications
You must be signed in to change notification settings - Fork 7
Autocompleteinput select first match flag #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced a new state variable `autoSelectFirstOption` in the components file to manage the auto-selection behavior. - Updated the AutocompleteInput component to accept `autoSelectFirstOption` as a prop and modified the value setting logic based on this prop. - Added a checkbox in the UI to toggle the auto-select feature for better user control.
|
Caution Review failedThe pull request is closed. WalkthroughVersion bumped to 0.85.5 and an Changes
Sequence DiagramsequenceDiagram
actor User
participant UI as components.tsx
participant Input as AutocompleteInput.tsx
User->>UI: Toggle "Auto Select First Option" checkbox
activate UI
UI->>UI: Set autoSelectFirstOption state
UI->>Input: Pass autoSelectFirstOption prop
deactivate UI
activate Input
alt Query exists & Input open
alt autoSelectFirstOption = true
Note right of Input: Choose active item if present\nelse call onNewItem(query)
Input->>Input: Select active item / onNewItem(query)
else autoSelectFirstOption = false
Note right of Input: Do not auto-select\ncall onNewItem(query)
Input->>Input: onNewItem(query)
end
else No query or Input closed
Input->>Input: Use alternate handling (no auto-select)
end
deactivate Input
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.json(1 hunks)src/components.tsx(2 hunks)src/components/AutocompleteInput.tsx(3 hunks)
- Updated the query handling logic to ensure that the value is set based on the `isTyping` state and the `autoSelectFirstOption` prop. - Simplified the conditions for setting the value when the component is open and the query is present.
Fixes the issue where users could not add new items if their input partially matched an existing option (e.g., typing “egg” selects “eggs”).
Summary by CodeRabbit
New Features
Chores