Upgrading views
This commit is contained in:
@ -18,14 +18,25 @@ class DiscoverCategory extends React.Component {
|
||||
this.setWindowTitle();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.match.params.id != this.props.match.params.id) {
|
||||
this.loadCategory();
|
||||
}
|
||||
componentDidUpdate = ({
|
||||
match: {
|
||||
params: {
|
||||
id: prevId,
|
||||
},
|
||||
},
|
||||
category: prevCategory,
|
||||
}) => {
|
||||
const {
|
||||
match: {
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
},
|
||||
category,
|
||||
} = this.props;
|
||||
|
||||
if (!this.props.category && nextProps.category) {
|
||||
this.setWindowTitle(nextProps.category);
|
||||
}
|
||||
if (prevId !== id) this.loadCategory();
|
||||
if (!prevCategory && category) this.setWindowTitle(category);
|
||||
}
|
||||
|
||||
setWindowTitle(category = this.props.category) {
|
||||
|
||||
@ -158,11 +158,21 @@ class Discover extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps, newState) {
|
||||
// New seeds via URL
|
||||
if (newProps.match.params.seeds != this.props.match.params.seeds) {
|
||||
this.handleURLSeeds(newProps.match.params.seeds);
|
||||
}
|
||||
componentDiUpdate = ({
|
||||
match: {
|
||||
params: {
|
||||
seeds: prevSeeds,
|
||||
},
|
||||
},
|
||||
}) => {
|
||||
const {
|
||||
match: {
|
||||
params: {
|
||||
seeds,
|
||||
},
|
||||
},
|
||||
} = this.props;
|
||||
if (prevSeeds !== seeds) this.handleURLSeeds(seeds);
|
||||
}
|
||||
|
||||
handleContextMenu(e) {
|
||||
|
||||
Reference in New Issue
Block a user