Skip to content
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

chore(Dropdown): add props for semantic settings #147

Merged
merged 1 commit into from
Jan 20, 2016
Merged

Conversation

dvdzkwsk
Copy link
Member

No description provided.

@@ -39,7 +124,7 @@ export default class Dropdown extends Component {

render() {
const options = _.map(this.props.options, (opt, i) => {
return <option key={i} value={opt.value}>{opt.text}</option>;
return <option key={opt.value} value={opt.value}>{opt.text}</option>;
Copy link
Member Author

Choose a reason for hiding this comment

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

Minor fix while I'm in here, index as key is a risky anti-pattern, and since the value is a string value we can just use that as the key.

Copy link
Contributor

Choose a reason for hiding this comment

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

I swear React used to throw warnings in the console for this and then stopped. Not sure why they stopped.

Copy link
Member

Choose a reason for hiding this comment

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

Only warns if key is missing, there is no way for React to know if it is an index or a real key.

@eanplatter
Copy link
Contributor

🍂

@levithomason
Copy link
Member

🉑

maxSelections: this.props.maxSelections,
on: this.props.on,
placeholder: this.props.placeholder,
saveRemoveData: this.props.saveRemoteData,
Copy link

Choose a reason for hiding this comment

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

Looking at Dropdown Settings - Remote Settings this defaults to true, meaning form values persist to session storage. Though I haven't actually seen it function yet, it'd be nice to have in the future.

@ghost
Copy link

ghost commented Jan 20, 2016

💫

@dvdzkwsk dvdzkwsk merged commit 1effc2e into master Jan 20, 2016
@dvdzkwsk dvdzkwsk deleted the fix/Dropdown branch January 20, 2016 20:30
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.

3 participants