diff --git a/react/components/ChannelClaimsDisplay/index.js b/react/components/ChannelClaimsDisplay/index.js index 8f186825..6603cc2e 100644 --- a/react/components/ChannelClaimsDisplay/index.js +++ b/react/components/ChannelClaimsDisplay/index.js @@ -17,11 +17,16 @@ class ChannelClaimsDisplay extends React.Component { this.showNextResultsPage = this.showNextResultsPage.bind(this); } componentDidMount () { - this.updateClaimsData(1); - } - updateClaimsData (page) { const name = this.props.name; const longId = this.props.longId; + this.updateClaimsData(name, longId, 1); + } + componentWillReceiveProps (nextProps) { + if (nextProps.name !== this.props.name || nextProps.longId !== this.props.longId) { + this.updateClaimsData(nextProps.name, nextProps.longId, 1); + } + } + updateClaimsData (name, longId, page) { const url = `/api/channel-claims/${name}/${longId}/${page}`; const that = this; return request(url) diff --git a/react/containers/ShowChannel/view.jsx b/react/containers/ShowChannel/view.jsx index 0b15ef32..de9d6675 100644 --- a/react/containers/ShowChannel/view.jsx +++ b/react/containers/ShowChannel/view.jsx @@ -17,6 +17,11 @@ class ShowChannel extends React.Component { componentDidMount () { this.getAndStoreChannelData(this.props.requestName, this.props.requestId); } + componentWillReceiveProps (nextProps) { + if (nextProps.requestName !== this.props.requestName || nextProps.requestId !== this.props.requestId) { + this.getAndStoreChannelData(nextProps.requestName, nextProps.requestId); + } + } getAndStoreChannelData (name, id) { if (!id) id = 'none'; const url = `/api/channel-data/${name}/${id}`; @@ -28,6 +33,7 @@ class ShowChannel extends React.Component { return that.setState({error: message}); } this.setState({ + error : null, name : data.channelName, longId : data.longChannelClaimId, shortId: data.shortChannelClaimId, diff --git a/react/containers/ShowPage/view.jsx b/react/containers/ShowPage/view.jsx index b7057031..c093ddd4 100644 --- a/react/containers/ShowPage/view.jsx +++ b/react/containers/ShowPage/view.jsx @@ -23,8 +23,8 @@ class ShowPage extends React.Component { this.parseUrlAndUpdateState(identifier, claim); } componentWillReceiveProps (nextProps) { - if (this.props.match.params !== nextProps.match.params) { - console.log('received new params props'); + if (nextProps.match.params !== this.props.match.params) { + console.log('ShowPage received new params props'); const identifier = nextProps.match.params.identifier; const claim = nextProps.match.params.claim; this.parseUrlAndUpdateState(identifier, claim);