mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
Fix collapse all button
This commit is contained in:
@@ -4,7 +4,7 @@ import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
// @ts-ignore
|
||||
import { Decoration, getChangeKey, Hunk } from "react-diff-view";
|
||||
import { Button, ButtonGroup } from "../buttons";
|
||||
import { ButtonGroup } from "../buttons";
|
||||
import Tag from "../Tag";
|
||||
import Icon from "../Icon";
|
||||
import { Change, ChangeEvent, DiffObjectProps, File, Hunk as HunkType } from "./DiffTypes";
|
||||
@@ -72,6 +72,14 @@ class DiffFile extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>, snapshot?: any): void {
|
||||
if (this.props.defaultCollapse !== prevProps.defaultCollapse) {
|
||||
this.setState({
|
||||
collapsed: this.defaultCollapse()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
defaultCollapse: () => boolean = () => {
|
||||
const { defaultCollapse, file } = this.props;
|
||||
if (typeof defaultCollapse === "boolean") {
|
||||
|
||||
Reference in New Issue
Block a user