mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 02:55:56 +01:00
fix re-render bug for changesets
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { withRouter, RouteComponentProps } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Branch, Changeset, PagedCollection, Repository } from "@scm-manager/ui-types";
|
||||
import {
|
||||
@@ -20,23 +20,21 @@ import {
|
||||
selectListAsCollection
|
||||
} from "../modules/changesets";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
repository: Repository;
|
||||
branch: Branch;
|
||||
page: number;
|
||||
type Props = RouteComponentProps &
|
||||
WithTranslation & {
|
||||
repository: Repository;
|
||||
branch: Branch;
|
||||
page: number;
|
||||
|
||||
// State props
|
||||
changesets: Changeset[];
|
||||
list: PagedCollection;
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
// State props
|
||||
changesets: Changeset[];
|
||||
list: PagedCollection;
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
|
||||
// Dispatch props
|
||||
fetchChangesets: (p1: Repository, p2: Branch, p3: number) => void;
|
||||
|
||||
// context props
|
||||
match: any;
|
||||
};
|
||||
// Dispatch props
|
||||
fetchChangesets: (p1: Repository, p2: Branch, p3: number) => void;
|
||||
};
|
||||
|
||||
class Changesets extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
@@ -44,6 +42,10 @@ class Changesets extends React.Component<Props> {
|
||||
fetchChangesets(repository, branch, page);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: Readonly<Props>, nextState: Readonly<{}>, nextContext: any): boolean {
|
||||
return this.props.changesets !== nextProps.changesets;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { changesets, loading, error, t } = this.props;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user