Fix formatting

This commit is contained in:
Rene Pfeuffer
2019-12-17 12:42:05 +01:00
parent 7da7a68817
commit f257a8eeb8
2 changed files with 19 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ type Props = WithTranslation & {
type State = { type State = {
stoppableUpdateHandler?: number; stoppableUpdateHandler?: number;
} };
const FixedWidthTh = styled.th` const FixedWidthTh = styled.th`
width: 16px; width: 16px;
@@ -46,7 +46,6 @@ export function findParent(path: string) {
} }
class FileTree extends React.Component<Props, State> { class FileTree extends React.Component<Props, State> {
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
this.state = {}; this.state = {};
@@ -54,10 +53,10 @@ class FileTree extends React.Component<Props, State> {
componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>): void { componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>): void {
if (prevState.stoppableUpdateHandler === this.state.stoppableUpdateHandler) { if (prevState.stoppableUpdateHandler === this.state.stoppableUpdateHandler) {
const {tree, updateSources} = this.props; const { tree, updateSources } = this.props;
if (tree?._embedded?.children && tree._embedded.children.find(c => c.partialResult)) { if (tree?._embedded?.children && tree._embedded.children.find(c => c.partialResult)) {
const stoppableUpdateHandler = setTimeout(updateSources, 3000); const stoppableUpdateHandler = setTimeout(updateSources, 3000);
this.setState({stoppableUpdateHandler: stoppableUpdateHandler}); this.setState({ stoppableUpdateHandler: stoppableUpdateHandler });
} }
} }
} }
@@ -177,5 +176,8 @@ const mapStateToProps = (state: any, ownProps: Props) => {
export default compose( export default compose(
withRouter, withRouter,
connect(mapStateToProps, mapDispatchToProps) connect(
mapStateToProps,
mapDispatchToProps
)
)(withTranslation("repos")(FileTree)); )(withTranslation("repos")(FileTree));

View File

@@ -9,16 +9,13 @@ export const FETCH_SOURCES_PENDING = `${FETCH_SOURCES}_${types.PENDING_SUFFIX}`;
export const FETCH_SOURCES_SUCCESS = `${FETCH_SOURCES}_${types.SUCCESS_SUFFIX}`; export const FETCH_SOURCES_SUCCESS = `${FETCH_SOURCES}_${types.SUCCESS_SUFFIX}`;
export const FETCH_SOURCES_FAILURE = `${FETCH_SOURCES}_${types.FAILURE_SUFFIX}`; export const FETCH_SOURCES_FAILURE = `${FETCH_SOURCES}_${types.FAILURE_SUFFIX}`;
export function fetchSources( `export function fetchSources(repository: Repository, revision: string, path: string, initialLoad = true) {
repository: Repository,
revision: string,
path: string,
initialLoad = true
) {
return function(dispatch: any, getState: () => any) { return function(dispatch: any, getState: () => any) {
const state = getState(); const state = getState();
if (isFetchSourcesPending(state, repository, revision, path) if (
|| isUpdateSourcePending(state, repository, revision, path)) { isFetchSourcesPending(state, repository, revision, path) ||
isUpdateSourcePending(state, repository, revision, path)
) {
return; return;
} }
@@ -57,10 +54,15 @@ export function fetchSourcesPending(repository: Repository, revision: string, pa
}; };
} }
export function updateSourcesPending(repository: Repository, revision: string, path: string, currentSources: any): Action { export function updateSourcesPending(
repository: Repository,
revision: string,
path: string,
currentSources: any
): Action {
return { return {
type: "UPDATE_PENDING", type: "UPDATE_PENDING",
payload: { updatePending: true, sources: currentSources}, payload: { updatePending: true, sources: currentSources },
itemId: createItemId(repository, revision, path) itemId: createItemId(repository, revision, path)
}; };
} }