File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,13 @@ async function renameOrCopyModule(
287287 storage : commonStorage . Storage , project : Project , newClassName : string ,
288288 oldModule : storageModule . Module , rename : boolean ) : Promise < string > {
289289 const newModulePath = storageNames . makeModulePath ( project . projectName , newClassName ) ;
290- const moduleContentText = await storage . fetchModuleContentText ( oldModule . modulePath ) ;
290+ let moduleContentText = await storage . fetchModuleContentText ( oldModule . modulePath ) ;
291+ if ( ! rename ) {
292+ // Change the ids in the module.
293+ const moduleContent = storageModuleContent . parseModuleContentText ( moduleContentText ) ;
294+ moduleContent . changeIds ( ) ;
295+ moduleContentText = moduleContent . getModuleContentText ( ) ;
296+ }
291297 await storage . saveModule ( newModulePath , moduleContentText ) ;
292298 if ( rename ) {
293299 // For rename, delete the old module.
@@ -462,7 +468,7 @@ async function processUploadedBlob(blobUrl: string): Promise<{ [className: strin
462468 } ) ;
463469
464470 // Wait for all promises to resolve.
465- const files : { [ key : string ] : string } = { } ; // key is file name, value is content
471+ const files : { [ fileName : string ] : string } = { } ; // value is file content
466472 await Promise . all (
467473 Object . entries ( promises ) . map ( async ( [ filename , promise ] ) => {
468474 files [ filename ] = await promise ;
You can’t perform that action at this time.
0 commit comments