1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 15:38:15 +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,24 +220,31 @@ 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)) { if (Utils.isMarkdownFile(path)) {
seafileAPI.getFileInfo(this.props.repoID, path).then(() => { 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); this.showFile(path);
}).catch(() => { }).catch(() => {
this.showDir(path); // After an error occurs, follow dir if (this.state.currentMode === 'column') { // After an error occurs, follow dir
}); this.loadSidePanel(path);
this.showDir(path);
} else { } else {
this.showDir(path); this.showDir(path);
} }
// load side-panel data });
} else {
if (this.state.currentMode === 'column') {
this.loadSidePanel(path); this.loadSidePanel(path);
this.showDir(path);
} else { } else {
this.showDir(path); this.showDir(path);
} }
} }
}
loadSidePanel = (path) => { loadSidePanel = (path) => {
let repoID = this.props.repoID; let repoID = this.props.repoID;