fix(company-input-v2): commit typed/autofilled value on blur#241
fix(company-input-v2): commit typed/autofilled value on blur#241gcutrini wants to merge 1 commit into
Conversation
MUI Autocomplete in freeSolo mode only fires onChange when the user
explicitly selects an option, so values entered via typing-and-tabbing
or browser autofill (notably iOS Chrome) never propagate to the parent
and required-field validation fails on submit.
- Enable Autocomplete autoSelect so the current input value is committed
on blur, matching MUI's intended pattern for free-text combos.
- Normalize string values inside onChange to the {id, name} shape that
consumers expect, since autoSelect emits the raw typed string.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughCompanyInputV2 now enables autoSelect on the Autocomplete component and normalizes raw typed strings by trimming and converting them into ChangesCompany Input String Normalization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
ref: https://app.clickup.com/t/86b9rnr4r
Summary
CompanyInputV2wraps MUI Autocomplete infreeSolomode, butonChangeonly fires when the user explicitly selects an option. Values entered via typing-and-tabbing or browser autofill (notably iOS Chrome) never propagate to the parent, so required-field validation fails on submit.Reproduce with autofill simulation in DevTools: set the input value via the native setter, dispatch
input, then blur — without this PR the parent'scompanystays{id: null, name: ""}; with it the parent receives{id: 0, name: <typed>}.Changes
autoSelectto the Autocomplete. MUI's intended mechanism for committing the current input value on blur in a free-text combo.onChangeto the{id, name}shape consumers expect, sinceautoSelectcallsonChangewith the raw typed/autofilled string.Summary by CodeRabbit