Update RouteDelegate only conditionally

This commit is contained in:
Philipp Czora
2018-10-12 16:07:24 +02:00
parent 2de0287bf9
commit 53fe671a27
3 changed files with 58 additions and 27 deletions

View File

@@ -36,7 +36,7 @@ type Props = {
type State = {};
class ChangesetContainer extends React.Component<Props, State> {
class Changesets extends React.Component<Props, State> {
componentDidMount() {
const {
fetchChangesetsByBranch,
@@ -45,6 +45,9 @@ class ChangesetContainer extends React.Component<Props, State> {
branch,
match
} = this.props;
console.log("branch");
console.log(branch);
const { page } = match.params;
if (!page) {
fetchChangesetsByBranch(repository, branch);
@@ -54,7 +57,11 @@ class ChangesetContainer extends React.Component<Props, State> {
}
render() {
const { changesets, loading, error, t } = this.props;
const { repository, branch, changesets, loading, error, t } = this.props;
if (!repository || !branch) {
return null;
}
if (error) {
return (
@@ -121,5 +128,5 @@ export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps
)(translate("repos")(ChangesetContainer))
)(translate("repos")(Changesets))
);