diff --git a/frontend/src/components/dialog/create-file-dialog.js b/frontend/src/components/dialog/create-file-dialog.js index 39d8fe6447..a3d755f176 100644 --- a/frontend/src/components/dialog/create-file-dialog.js +++ b/frontend/src/components/dialog/create-file-dialog.js @@ -17,7 +17,7 @@ class CreateFile extends React.Component { super(props); this.state = { parentPath: '', - childName: props.fileType, + childName: props.fileType || '', isDraft: false, errMessage: '', }; diff --git a/frontend/src/draft.js b/frontend/src/draft.js index d245ffb763..5cac87ac08 100644 --- a/frontend/src/draft.js +++ b/frontend/src/draft.js @@ -249,9 +249,11 @@ class Draft extends React.Component { } getDraftInfo = () => { - seafileAPI.getFileInfo(draftRepoID, draftFilePath).then((res) => { - this.setState({ draftInfo: res.data }); - }); + if (draftStatus === 'open') { + seafileAPI.getFileInfo(draftRepoID, draftFilePath).then((res) => { + this.setState({ draftInfo: res.data }); + }); + } } getChangedNodes = () => {