diff --git a/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx b/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx index b10f0878d7..6a9186b3e7 100644 --- a/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx +++ b/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx @@ -115,8 +115,8 @@ class FileTree extends React.Component { return null; } - if (hunks.some(hunk => hunk.error)) { - return hunk.error)[0]} />; + if (hunks[0]?.error) { + return ; } return ( @@ -183,6 +183,7 @@ class FileTree extends React.Component { {hunks[hunks.length - 1].loading && } + {hunks[hunks.length - 1].error && } ); } @@ -210,9 +211,11 @@ const mapStateToProps = (state: any, ownProps: Props) => { for (let i = 0; i < hunkCount; ++i) { const tree = getSources(state, repository, revision, path, i); const loading = isFetchSourcesPending(state, repository, revision, path, i); + const error = getFetchSourcesFailure(state, repository, revision, path, i); hunks.push({ tree, - loading + loading, + error }); } diff --git a/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts b/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts index 779a554aa4..cb9771a181 100644 --- a/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts +++ b/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts @@ -103,7 +103,7 @@ export function fetchSourcesFailure( ): Action { return { type: FETCH_SOURCES_FAILURE, - payload: error, + payload: { hunk, pending: false, updatePending: false, error }, itemId: createItemId(repository, revision, path, "") }; } @@ -122,12 +122,13 @@ export default function reducer( type: "UNKNOWN" } ): any { - if (action.itemId && action.type === FETCH_SOURCES_SUCCESS) { + if (action.itemId && (action.type === FETCH_SOURCES_SUCCESS || action.type === FETCH_SOURCES_FAILURE)) { return { ...state, [action.itemId + "hunkCount"]: action.payload.hunk + 1, [action.itemId + action.payload.hunk]: { sources: action.payload.sources, + error: action.payload.error, updatePending: false, pending: false } @@ -220,5 +221,5 @@ export function getFetchSourcesFailure( path: string, hunk = 0 ): Error | null | undefined { - return getFailure(state, FETCH_SOURCES, createItemId(repository, revision, path, "")); + return state.sources[createItemId(repository, revision, path, hunk)]?.error; }