1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

repair column view file loading error (#3013)

* repair column view file loading error

* optimized judegment
This commit is contained in:
杨顺强
2019-02-28 15:36:14 +08:00
committed by Daniel Pan
parent 16c386ac91
commit 22feb7093b

View File

@@ -220,22 +220,29 @@ class LibContentView extends React.Component {
});
});
if (this.state.currentMode === 'column') {
// there will be only two constence. path is file or path is dir.
if (Utils.isMarkdownFile(path)) {
seafileAPI.getFileInfo(this.props.repoID, path).then(() => {
this.showFile(path);
}).catch(() => {
this.showDir(path); // After an error occurs, follow dir
});
if (Utils.isMarkdownFile(path)) {
seafileAPI.getFileInfo(this.props.repoID, path).then(() => {
if (this.state.currentMode !== 'column') {
cookie.save('seafile-view-mode', 'column');
this.setState({currentMode: 'column'});
}
this.loadSidePanel(path);
this.showFile(path);
}).catch(() => {
if (this.state.currentMode === 'column') { // After an error occurs, follow dir
this.loadSidePanel(path);
this.showDir(path);
} else {
this.showDir(path);
}
});
} else {
if (this.state.currentMode === 'column') {
this.loadSidePanel(path);
this.showDir(path);
} else {
this.showDir(path);
}
// load side-panel data
this.loadSidePanel(path);
} else {
this.showDir(path);
}
}