@@ -252,7 +252,11 @@ export function rm(...paths) {
252252 name : arr [ i + 1 ] ,
253253 fn : ( file ) => {
254254 if ( file . name === arr [ i + 1 ] ) {
255- file = { ...file , loading : false , last : false } ;
255+ file = {
256+ ...file ,
257+ loading : false ,
258+ last : false
259+ } ;
256260 }
257261 return file ;
258262 } ,
@@ -274,17 +278,20 @@ export function mv(fromPath, toPath) {
274278 */
275279 before ( ) {
276280 if ( fromBasepath === toBasepath ) this . _beforeSamePath ( ) ;
277- else this . _beforeSamePath ( ) ;
281+ else this . _beforeDifferentPath ( ) ;
278282 }
279283
280284 _beforeSamePath ( ) {
281285 stateAdd ( mutationFiles$ , fromBasepath , {
282286 name : fromName ,
283287 fn : ( file ) => {
284288 if ( file . name === fromName ) {
285- file . loading = true ;
286- file . name = toName ;
287289 type = file . type ;
290+ return {
291+ ...file ,
292+ name : toName ,
293+ loading : true ,
294+ } ;
288295 }
289296 return file ;
290297 } ,
@@ -296,9 +303,12 @@ export function mv(fromPath, toPath) {
296303 name : fromName ,
297304 fn : ( file ) => {
298305 if ( file . name === fromName ) {
299- file . loading = true ;
300- file . last = true ;
301306 type = file . type ;
307+ return {
308+ ...file ,
309+ loading : true ,
310+ last : true ,
311+ } ;
302312 }
303313 return file ;
304314 } ,
@@ -374,10 +384,31 @@ export function mv(fromPath, toPath) {
374384 * @override
375385 */
376386 async afterError ( ) {
377- statePop ( mutationFiles$ , fromBasepath , fromName ) ;
378- if ( fromBasepath !== toBasepath ) {
387+ if ( fromBasepath === toBasepath ) stateAdd ( mutationFiles$ , fromBasepath , {
388+ name : fromName ,
389+ fn : ( file ) => {
390+ if ( file . name === toName ) return {
391+ ...file ,
392+ name : fromName ,
393+ loading : false ,
394+ } ;
395+ return file ;
396+ } ,
397+ } ) ; else {
398+ stateAdd ( mutationFiles$ , fromBasepath , {
399+ name : fromName ,
400+ fn : ( file ) => {
401+ if ( file . name === fromName ) return {
402+ ...file ,
403+ loading : false ,
404+ last : false ,
405+ }
406+ return file ;
407+ } ,
408+ } ) ;
379409 statePop ( virtualFiles$ , toBasepath , toName ) ;
380410 }
411+ statePop ( mutationFiles$ , fromBasepath , fromName ) ;
381412 return rxjs . EMPTY ;
382413 }
383414 } ( ) ;
0 commit comments