File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -135,11 +135,15 @@ export function createFolder(formProps) {
135
135
} ;
136
136
}
137
137
138
- export function updateFileName ( id , name ) {
139
- return {
140
- type : ActionTypes . UPDATE_FILE_NAME ,
141
- id,
142
- name
138
+ export function updateFileName ( id , name , updatedName = '' ) {
139
+ return ( dispatch ) => {
140
+ // Notify Changes if necessary
141
+ // Update the Filename
142
+ dispatch ( {
143
+ type : ActionTypes . UPDATE_FILE_NAME ,
144
+ id,
145
+ name
146
+ } ) ;
143
147
} ;
144
148
}
145
149
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export class FileNode extends React.Component {
61
61
62
62
63
63
handleFileNameChange ( event ) {
64
- this . props . updateFileName ( this . props . id , event . target . value ) ;
64
+ this . props . updateFileName ( this . props . id , event . target . value , this . getName ( ) ) ;
65
65
}
66
66
67
67
handleKeyPress ( event ) {
@@ -82,7 +82,7 @@ export class FileNode extends React.Component {
82
82
const hasEmptyFilename = newFileName === '' ;
83
83
const hasOnlyExtension = newFileExtension && newFileName === newFileExtension [ 0 ] ;
84
84
if ( hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder ) {
85
- this . props . updateFileName ( this . props . id , this . originalFileName ) ;
85
+ this . props . updateFileName ( this . props . id , this . originalFileName , this . getName ( ) ) ;
86
86
}
87
87
}
88
88
You can’t perform that action at this time.
0 commit comments