diff --git a/client/modules/IDE/components/FileNode.jsx b/client/modules/IDE/components/FileNode.jsx
index f6563706..2979489e 100644
--- a/client/modules/IDE/components/FileNode.jsx
+++ b/client/modules/IDE/components/FileNode.jsx
@@ -47,13 +47,19 @@ export class FileNode extends React.Component {
}, 200);
}
+ getName() {
+ const { updatedName, name } = this.props;
+ return updatedName || name;
+ }
+
handleFileClick(e) {
e.stopPropagation();
- if (this.props.name !== 'root' && !this.isDeleting) {
+ if (this.getName() !== 'root' && !this.isDeleting) {
this.props.setSelectedFile(this.props.id);
}
}
+
handleFileNameChange(event) {
this.props.updateFileName(this.props.id, event.target.value);
}
@@ -66,9 +72,9 @@ export class FileNode extends React.Component {
validateFileName() {
const oldFileExtension = this.originalFileName.match(/\.[0-9a-z]+$/i);
- const newFileExtension = this.props.name.match(/\.[0-9a-z]+$/i);
- const hasPeriod = this.props.name.match(/\.+/);
- const newFileName = this.props.name;
+ const newFileExtension = this.getName().match(/\.[0-9a-z]+$/i);
+ const hasPeriod = this.getName().match(/\.+/);
+ const newFileName = this.getName();
const hasNoExtension = oldFileExtension && !newFileExtension;
const hasExtensionIfFolder = this.props.fileType === 'folder' && hasPeriod;
const notSameExtension = oldFileExtension && newFileExtension
@@ -115,8 +121,8 @@ export class FileNode extends React.Component {
render() {
const itemClass = classNames({
- 'sidebar__root-item': this.props.name === 'root',
- 'sidebar__file-item': this.props.name !== 'root',
+ 'sidebar__root-item': this.getName() === 'root',
+ 'sidebar__file-item': this.getName() !== 'root',
'sidebar__file-item--selected': this.props.isSelectedFile,
'sidebar__file-item--open': this.state.isOptionsOpen,
'sidebar__file-item--editing': this.state.isEditingName,
@@ -126,7 +132,7 @@ export class FileNode extends React.Component {
return (
{(() => { // eslint-disable-line
- if (this.props.name !== 'root') {
+ if (this.getName() !== 'root') {
return (
@@ -155,11 +161,11 @@ export class FileNode extends React.Component {
);
})()}
-
+
{ this.fileNameInput = element; }}
@@ -225,7 +231,7 @@ export class FileNode extends React.Component {