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);
|
this.showNextResultsPage = this.showNextResultsPage.bind(this);
|
||||||
}
|
}
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.updateClaimsData(1);
|
|
||||||
}
|
|
||||||
updateClaimsData (page) {
|
|
||||||
const name = this.props.name;
|
const name = this.props.name;
|
||||||
const longId = this.props.longId;
|
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 url = `/api/channel-claims/${name}/${longId}/${page}`;
|
||||||
const that = this;
|
const that = this;
|
||||||
return request(url)
|
return request(url)
|
||||||
|
|
|
@ -17,6 +17,11 @@ class ShowChannel extends React.Component {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.getAndStoreChannelData(this.props.requestName, this.props.requestId);
|
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) {
|
getAndStoreChannelData (name, id) {
|
||||||
if (!id) id = 'none';
|
if (!id) id = 'none';
|
||||||
const url = `/api/channel-data/${name}/${id}`;
|
const url = `/api/channel-data/${name}/${id}`;
|
||||||
|
@ -28,6 +33,7 @@ class ShowChannel extends React.Component {
|
||||||
return that.setState({error: message});
|
return that.setState({error: message});
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
|
error : null,
|
||||||
name : data.channelName,
|
name : data.channelName,
|
||||||
longId : data.longChannelClaimId,
|
longId : data.longChannelClaimId,
|
||||||
shortId: data.shortChannelClaimId,
|
shortId: data.shortChannelClaimId,
|
||||||
|
|
|
@ -23,8 +23,8 @@ class ShowPage extends React.Component {
|
||||||
this.parseUrlAndUpdateState(identifier, claim);
|
this.parseUrlAndUpdateState(identifier, claim);
|
||||||
}
|
}
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
if (this.props.match.params !== nextProps.match.params) {
|
if (nextProps.match.params !== this.props.match.params) {
|
||||||
console.log('received new params props');
|
console.log('ShowPage received new params props');
|
||||||
const identifier = nextProps.match.params.identifier;
|
const identifier = nextProps.match.params.identifier;
|
||||||
const claim = nextProps.match.params.claim;
|
const claim = nextProps.match.params.claim;
|
||||||
this.parseUrlAndUpdateState(identifier, claim);
|
this.parseUrlAndUpdateState(identifier, claim);
|
||||||
|
|
Loading…
Reference in a new issue