diff --git a/src/public/js/components/list/explorerOptions.js b/src/public/js/components/list/explorerOptions.js index d71e0ea..f4ed65b 100644 --- a/src/public/js/components/list/explorerOptions.js +++ b/src/public/js/components/list/explorerOptions.js @@ -11,9 +11,11 @@ export default class ExplorerOptions extends React.Component { // Check if the options are present if (Object.keys(this.props.options).length === 0) { // Fetch options - this.props.fetchOptions(); + props.fetchOptions(); // Explore - this.props.explore(this.props.params.source, this.props.params.category); + if (this.propsValid(props)) { + props.explore(props.params.source, props.params.category); + } } else { source = this.props.params.source; category = this.props.params.category; @@ -42,12 +44,19 @@ export default class ExplorerOptions extends React.Component { this.setState({ selectedCategory: event.target.value }); this.props.router.push(`/${this.props.type}/explore/${this.state.selectedSource}/${event.target.value}`); } + propsValid(props) { + if (!props.params + || !props.params.source + || !props.params.category + || (props.params.source === "") + || (props.params.category === "")) { + return false + } + return true; + } componentWillUpdate(nextProps, nextState) { // Check props - if (!nextProps.params.source - || !nextProps.params.category - || (nextProps.params.source === "") - || (nextProps.params.category === "")) { + if (!this.propsValid(nextProps)) { return }