diff --git a/client/modules/IDE/actions/files.js b/client/modules/IDE/actions/files.js index 8fb230cc..81b7febc 100644 --- a/client/modules/IDE/actions/files.js +++ b/client/modules/IDE/actions/files.js @@ -135,11 +135,15 @@ export function createFolder(formProps) { }; } -export function updateFileName(id, name) { - return { - type: ActionTypes.UPDATE_FILE_NAME, - id, - name +export function updateFileName(id, name, updatedName = '') { + return (dispatch) => { + // Notify Changes if necessary + // Update the Filename + dispatch({ + type: ActionTypes.UPDATE_FILE_NAME, + id, + name + }); }; } diff --git a/client/modules/IDE/components/FileNode.jsx b/client/modules/IDE/components/FileNode.jsx index 2979489e..160cc6a3 100644 --- a/client/modules/IDE/components/FileNode.jsx +++ b/client/modules/IDE/components/FileNode.jsx @@ -61,7 +61,7 @@ export class FileNode extends React.Component { handleFileNameChange(event) { - this.props.updateFileName(this.props.id, event.target.value); + this.props.updateFileName(this.props.id, event.target.value, this.getName()); } handleKeyPress(event) { @@ -82,7 +82,7 @@ export class FileNode extends React.Component { const hasEmptyFilename = newFileName === ''; const hasOnlyExtension = newFileExtension && newFileName === newFileExtension[0]; if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) { - this.props.updateFileName(this.props.id, this.originalFileName); + this.props.updateFileName(this.props.id, this.originalFileName, this.getName()); } }