mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Fix loading detection
This commit is contained in:
@@ -105,7 +105,6 @@ class FileTree extends React.Component<Props, State> {
|
|||||||
return (
|
return (
|
||||||
<div className="panel-block">
|
<div className="panel-block">
|
||||||
{this.renderSourcesTable()}
|
{this.renderSourcesTable()}
|
||||||
{lastHunk.loading && <Loading />}
|
|
||||||
{lastHunk.tree?.truncated && <Button label={t("sources.loadMore")} action={this.loadMore} />}
|
{lastHunk.tree?.truncated && <Button label={t("sources.loadMore")} action={this.loadMore} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -124,6 +123,10 @@ class FileTree extends React.Component<Props, State> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hunks.every(hunk => hunk.loading)) {
|
||||||
|
return <Loading />;
|
||||||
|
}
|
||||||
|
|
||||||
hunks
|
hunks
|
||||||
.filter(hunk => !hunk.loading)
|
.filter(hunk => !hunk.loading)
|
||||||
.forEach(hunk => {
|
.forEach(hunk => {
|
||||||
@@ -144,6 +147,7 @@ class FileTree extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<table className="table table-hover table-sm is-fullwidth">
|
<table className="table table-hover table-sm is-fullwidth">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -161,6 +165,8 @@ class FileTree extends React.Component<Props, State> {
|
|||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{hunks[hunks.length - 1].loading && <Loading />}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return <Notification type="info">{t("sources.noSources")}</Notification>;
|
return <Notification type="info">{t("sources.noSources")}</Notification>;
|
||||||
@@ -185,7 +191,6 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
|||||||
const hunkCount = getHunkCount(state, repository, revision, path);
|
const hunkCount = getHunkCount(state, repository, revision, path);
|
||||||
const hunks = [];
|
const hunks = [];
|
||||||
for (let i = 0; i < hunkCount; ++i) {
|
for (let i = 0; i < hunkCount; ++i) {
|
||||||
console.log(`getting data for hunk ${i}`);
|
|
||||||
const tree = getSources(state, repository, revision, path, i);
|
const tree = getSources(state, repository, revision, path, i);
|
||||||
const loading = isFetchSourcesPending(state, repository, revision, path, i);
|
const loading = isFetchSourcesPending(state, repository, revision, path, i);
|
||||||
hunks.push({
|
hunks.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user