-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[ComboBox]: prevent component props mutation. #2818
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
👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. |
🟢 This pull request modifies 3 files and might impact 1 other files. Details:All files potentially affected (total: 1)📄
|
67bb0fb
to
17479ef
Compare
17479ef
to
e6f3748
Compare
How were you able to tophat your
|
I'm not familiar with AutoComplete, so I'm probably not the best person to review this, looks like @dleroux has got your back though |
Let me double check this in Playground, there is a test which is passed: |
Hey @dleroux, I checked import React from 'react';
import {CirclePlusMinor} from '@shopify/polaris-icons';
import {Page, Autocomplete} from '../src';
export function Playground() {
const textField = (
<Autocomplete.TextField
onChange={(value) => console.log(value)}
label=""
value=""
placeholder="placeholder"
/>
);
return (
<Page title="Playground">
<Autocomplete
options={[
{
label: 'label 1',
value: '1',
},
{
label: 'label 2',
value: '2',
},
]}
selected={['1']}
onSelect={() => console.log('update')}
textField={textField}
actionBefore={{
content: "Add 'f'",
icon: CirclePlusMinor,
id: 'ComboBox3-0',
}}
/>
</Page>
);
} |
The code looks good, but mine keeps crashing, even with your playground on master. I've reopened the issue that was closed. Hopefully someone has time to tackle it soon but that's another issue. |
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.
I'm approving based on the code but hopefully someone else can tophat that prop can do the same. @AndrewMusgrave ?
🎉 Thanks for your contribution to Polaris React! |
WHY are these changes introduced?
Because of unexpected search options result was displayed like unexpected options result or duplicated options (see animation below).

Fixes #2764
WHAT is this pull request doing?
Prevents passed component props mutation.
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes