From 99f9e59bf57150423039e176550c30b6c4074b9d Mon Sep 17 00:00:00 2001 From: jim chen Date: Tue, 23 Jan 2018 09:30:18 +0800 Subject: [PATCH] fix TagSelect prop value is an undefined --- src/components/TagSelect/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index 40c38bc7..e0159aa7 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -24,7 +24,7 @@ class TagSelect extends Component { value: this.props.value || this.props.defaultValue || [], }; componentWillReceiveProps(nextProps) { - if ('value' in nextProps) { + if ('value' in nextProps && nextProps.value) { this.setState({ value: nextProps.value }); } } @@ -53,7 +53,7 @@ class TagSelect extends Component { const checkedTags = children .filter(child => this.isTagSelectOption(child)) .map(child => child.props.value); - return checkedTags; + return checkedTags || []; } handleTagChange = (value, checked) => { -- GitLab