1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 21:07:17 +00:00

fix sdoc history flash (#6481)

This commit is contained in:
Michael An
2024-08-02 18:03:20 +08:00
committed by GitHub
parent 6ce8336e9a
commit 59b9445f48

View File

@@ -125,7 +125,10 @@ class SdocFileHistory extends React.Component {
}; };
onSelectHistoryVersion = (currentVersion, lastVersion) => { onSelectHistoryVersion = (currentVersion, lastVersion) => {
this.setState({ isLoading: true, currentVersion }); this.setState({
currentVersion,
currentVersionContent: null,
});
seafileAPI.getFileRevision(historyRepoID, currentVersion.commit_id, currentVersion.path).then(res => { seafileAPI.getFileRevision(historyRepoID, currentVersion.commit_id, currentVersion.path).then(res => {
return seafileAPI.getFileContent(res.data); return seafileAPI.getFileContent(res.data);
}).then(res => { }).then(res => {
@@ -139,7 +142,13 @@ class SdocFileHistory extends React.Component {
}; };
setContent = (currentVersionContent = '', lastVersionContent = '') => { setContent = (currentVersionContent = '', lastVersionContent = '') => {
this.setState({ currentVersionContent, lastVersionContent, isLoading: false, changes: [], currentDiffIndex: 0 }); this.setState({
currentVersionContent,
lastVersionContent,
isLoading: false,
changes: [],
currentDiffIndex: 0,
});
}; };
onShowChanges = (isShowChanges, lastVersion) => { onShowChanges = (isShowChanges, lastVersion) => {
@@ -381,11 +390,15 @@ class SdocFileHistory extends React.Component {
</div> </div>
) : ( ) : (
<> <>
<DiffViewer {currentVersionContent === null ?
currentContent={currentVersionContent} <Loading />
lastContent={isShowChanges ? lastVersionContent : ''} :
didMountCallback={this.setDiffCount} <DiffViewer
/> currentContent={currentVersionContent}
lastContent={isShowChanges ? lastVersionContent : ''}
didMountCallback={this.setDiffCount}
/>
}
{ {
showSidePanel && ( showSidePanel && (
<SidePanel <SidePanel