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:
@@ -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
|
||||||
|
Reference in New Issue
Block a user