Skip to content

Commit

Permalink
Merge pull request elastic#4 from jen-huang/responsive-tables
Browse files Browse the repository at this point in the history
Add comments to getWatchedProps
  • Loading branch information
cchaos authored Apr 17, 2018
2 parents 1464795 + 01a2886 commit 3c6a941
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/context_menu/context_menu_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ export class EuiContextMenuPanel extends Component {
getWatchedProps(items) {
const { watchedItemProps } = this.props;

// Create array of each item's watched properties
if(items && items.length && watchedItemProps && watchedItemProps.length) {
return items.map(item => {
// Create object of item properties and values
const props = {
key: item.key,
};
Expand All @@ -250,6 +252,7 @@ export class EuiContextMenuPanel extends Component {
return true;
}

// Check if any watched item properties changed by quick string comparison
if(JSON.stringify(this.getWatchedProps(nextProps.items)) !== JSON.stringify(this.getWatchedProps(this.props.items))) {
return true;
}
Expand Down

0 comments on commit 3c6a941

Please sign in to comment.