fixed error where channel display would not refresh
This commit is contained in:
parent
6073935732
commit
fbe25e4aa1
3 changed files with 16 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue