@@ -494,6 +494,7 @@ function PdfRequestFiles() {
494
494
data . key === signKey && data . Width && data . Height && data . SignUrl
495
495
) ;
496
496
let getIMGWH = calculateImgAspectRatio ( imgWH ) ;
497
+
497
498
if ( updateFilter . length > 0 ) {
498
499
const getXYdata = currentSigner [ 0 ] . placeHolder [ i ] . pos ;
499
500
const getPosData = getXYdata ;
@@ -516,11 +517,17 @@ function PdfRequestFiles() {
516
517
}
517
518
return obj ;
518
519
} ) ;
519
- currentSigner [ 0 ] . placeHolder . splice ( i , 1 , newUpdateUrl [ 0 ] ) ;
520
+ const getPlaceData = currentSigner [ 0 ] . placeHolder ;
521
+ getPlaceData . splice ( 0 , getPlaceData . length , ...newUpdateUrl ) ;
522
+
520
523
const indexofSigner = signerPos . findIndex ( ( object ) => {
521
524
return object . signerObjId === signerObjectId ;
522
525
} ) ;
523
- signerPos . splice ( indexofSigner , 1 , currentSigner [ 0 ] ) ;
526
+ setSignerPos ( ( prevState ) => {
527
+ const newState = [ ...prevState ] ; // Create a copy of the state
528
+ newState . splice ( indexofSigner , 1 , ...currentSigner ) ; // Modify the copy
529
+ return newState ; // Update the state with the modified copy
530
+ } ) ;
524
531
} else {
525
532
const getXYdata = currentSigner [ 0 ] . placeHolder [ i ] . pos ;
526
533
@@ -546,11 +553,17 @@ function PdfRequestFiles() {
546
553
return obj ;
547
554
} ) ;
548
555
549
- currentSigner [ 0 ] . placeHolder . splice ( i , 1 , newUpdateUrl [ 0 ] ) ;
556
+ const getPlaceData = currentSigner [ 0 ] . placeHolder ;
557
+ getPlaceData . splice ( 0 , getPlaceData . length , ...newUpdateUrl ) ;
558
+
550
559
const indexofSigner = signerPos . findIndex ( ( object ) => {
551
560
return object . signerObjId === signerObjectId ;
552
561
} ) ;
553
- signerPos . splice ( indexofSigner , 1 , currentSigner [ 0 ] ) ;
562
+ setSignerPos ( ( prevState ) => {
563
+ const newState = [ ...prevState ] ; // Create a copy of the state
564
+ newState . splice ( indexofSigner , 1 , ...currentSigner ) ; // Modify the copy
565
+ return newState ; // Update the state with the modified copy
566
+ } ) ;
554
567
}
555
568
} ;
556
569
@@ -586,6 +599,7 @@ function PdfRequestFiles() {
586
599
updateFilter = currentSigner [ 0 ] . placeHolder [ i ] . pos . filter (
587
600
( data ) => data . key === signKey && data . SignUrl
588
601
) ;
602
+
589
603
const getXYdata = currentSigner [ 0 ] . placeHolder [ i ] . pos ;
590
604
const getPosData = getXYdata ;
591
605
const posWidth = isDefaultSign
@@ -633,12 +647,15 @@ function PdfRequestFiles() {
633
647
}
634
648
return obj ;
635
649
} ) ;
636
- let signerupdate = [ ] ;
637
- signerupdate = signerPos . filter (
638
- ( data ) => data . signerObjId ! == signerObjectId
650
+
651
+ const index = signerPos . findIndex (
652
+ ( data ) => data . signerObjId = == signerObjectId
639
653
) ;
640
- signerupdate . push ( newUpdatePos [ 0 ] ) ;
641
- setSignerPos ( signerupdate ) ;
654
+ setSignerPos ( ( prevState ) => {
655
+ const newState = [ ...prevState ] ; // Create a copy of the state
656
+ newState . splice ( index , 1 , ...newUpdatePos ) ; // Modify the copy
657
+ return newState ; // Update the state with the modified copy
658
+ } ) ;
642
659
}
643
660
} ;
644
661
0 commit comments