fixes refetching loop for non existing changesets

This commit is contained in:
Sebastian Sdorra
2020-06-17 16:45:53 +02:00
parent 231d81992a
commit 808a8a4107
2 changed files with 8 additions and 6 deletions

View File

@@ -48,15 +48,15 @@ type Props = WithTranslation & {
class ChangesetView extends React.Component<Props> {
componentDidMount() {
const { fetchChangesetIfNeeded, repository } = this.props;
const id = this.props.match.params.id;
const { fetchChangesetIfNeeded, repository, id } = this.props;
fetchChangesetIfNeeded(repository, id);
}
componentDidUpdate() {
const { fetchChangesetIfNeeded, repository } = this.props;
const id = this.props.match.params.id;
fetchChangesetIfNeeded(repository, id);
componentDidUpdate(prevProps: Props) {
const { fetchChangesetIfNeeded, repository, id } = this.props;
if (prevProps.id !== id) {
fetchChangesetIfNeeded(repository, id);
}
}
render() {
@@ -79,6 +79,7 @@ const mapStateToProps = (state: any, ownProps: Props) => {
const loading = isFetchChangesetPending(state, repository, id);
const error = getFetchChangesetFailure(state, repository, id);
return {
id,
changeset,
error,
loading