Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Bugfix: comparing type always returns false
Browse files Browse the repository at this point in the history
  • Loading branch information
driesd committed Apr 13, 2017
1 parent a17c624 commit 627367b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,17 @@ const factory = (MenuItem) => {
}

renderItems () {
// Because React Hot Loader creates proxied versions of your components,
// comparing reference types of elements won't work
// https://github.com/gaearon/react-hot-loader/blob/master/docs/Known%20Limitations.md#checking-element-types
const MenuItemType = (<MenuItem />).type;

return React.Children.map(this.props.children, (item) => {
if (!item) {
return item;
}
if (item.type === MenuItem) {

if (item.type === MenuItemType) {
return React.cloneElement(item, {
selected: typeof item.props.value !== 'undefined' &&
this.props.selectable &&
Expand Down

0 comments on commit 627367b

Please sign in to comment.