From c50802cf9293d5caafbb9df8d93a6d86a7ec10c0 Mon Sep 17 00:00:00 2001 From: Gregory Pinto Date: Mon, 26 Oct 2015 14:59:38 -0700 Subject: [PATCH] Fixed the lookup not updating when props.items changes --- components/SLDSLookup/index.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/SLDSLookup/index.jsx b/components/SLDSLookup/index.jsx index 22b281d6f7..9f3add45a9 100644 --- a/components/SLDSLookup/index.jsx +++ b/components/SLDSLookup/index.jsx @@ -40,7 +40,7 @@ class SLDSLookup extends React.Component { } componentDidMount(){ - this.modifyItems(); + this.modifyItems(this.props.items); } componentDidUpdate(prevProps, prevState){ @@ -237,8 +237,8 @@ class SLDSLookup extends React.Component { ); } - modifyItems () { - const items = this.props.items.map((item, index) => { + modifyItems (itemsToModify) { + const items = itemsToModify.map((item, index) => { return { id : 'item-' + index, label: item.label, @@ -250,7 +250,9 @@ class SLDSLookup extends React.Component { } componentWillReceiveProps (newProps) { - this.modifyItems(); + if(newProps.items){ + this.modifyItems(newProps.items); + } } render(){