1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-18 01:03:40 +00:00

fix file history page bug

This commit is contained in:
王健辉 2019-04-26 14:35:30 +08:00
parent d9345e1c8b
commit 7bd80c7a0c

View File

@ -122,12 +122,12 @@ class FileHistory extends React.Component {
this.setState({isReloadingData: true}); this.setState({isReloadingData: true});
if (oldFilePath) { if (oldFilePath) {
seafileAPI.listOldFileHistoryRecords(historyRepoID, oldFilePath, commitID).then((res) => { seafileAPI.listOldFileHistoryRecords(historyRepoID, oldFilePath, commitID).then((res) => {
this.updateOldRecords(res.data); this.updateOldRecords(res.data, oldFilePath);
this.setState({isReloadingData: false}); this.setState({isReloadingData: false});
}); });
} else { } else {
seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, commitID).then((res) => { seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, commitID).then((res) => {
this.updateOldRecords(res.data); this.updateOldRecords(res.data, filePath);
this.setState({isReloadingData: false}); this.setState({isReloadingData: false});
}); });
} }
@ -144,7 +144,7 @@ class FileHistory extends React.Component {
}); });
} }
updateOldRecords(result) { updateOldRecords(result, filePath) {
if (result.data.length) { if (result.data.length) {
this.setState({ this.setState({
historyList: [...this.state.historyList, ...result.data], historyList: [...this.state.historyList, ...result.data],
@ -157,7 +157,7 @@ class FileHistory extends React.Component {
this.setState({nextCommit: result.next_start_commit,}); this.setState({nextCommit: result.next_start_commit,});
if (this.state.nextCommit) { if (this.state.nextCommit) {
seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, this.state.nextCommit).then((res) => { seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, this.state.nextCommit).then((res) => {
this.updateOldRecords(res.data); this.updateOldRecords(res.data, filePath);
}); });
} }
} }