@@ -13,7 +13,7 @@ import { identity } from 'cypress/types/lodash';
13
13
import { RowsOfData } from '@/Types' ;
14
14
15
15
type RowData = {
16
- [ key : string ] : string | number
16
+ [ key : string ] : string | number ;
17
17
}
18
18
19
19
type DataTableNodeColumnProp = {
@@ -35,14 +35,14 @@ export default function DataTableNodeColumn({row,id,deleteRow,index, PK}: DataTa
35
35
36
36
//reset the state when row changes. Specifically for on-delete functionality.
37
37
useEffect ( ( ) => {
38
- setRowData ( { ...newRow } )
39
- setTempData ( { ...newRow } )
38
+ setRowData ( { ...newRow } ) ;
39
+ setTempData ( { ...newRow } ) ;
40
40
} , [ row ] )
41
41
42
42
43
43
const [ mode , setMode ] = useState ( 'default' ) ;
44
44
45
- const rowDataKeys = Object . keys ( row )
45
+ const rowDataKeys = Object . keys ( row ) ;
46
46
47
47
interface rowData {
48
48
[ key :string | number ] :string | number | boolean | null
@@ -72,31 +72,31 @@ const onSave = async () => {
72
72
changes . newRow = { ...tempData } ;
73
73
//if statement necessary for typing correction
74
74
if ( PK [ 0 ] !== null && changes . newRow !== undefined ) {
75
- changes . primaryKey = { [ PK [ 0 ] ] :changes . newRow [ PK [ 0 ] ] }
75
+ changes . primaryKey = { [ PK [ 0 ] ] :changes . newRow [ PK [ 0 ] ] } ;
76
76
}
77
77
//delete primary key column from change for fetch request row.
78
- if ( PK [ 0 ] ) delete changes . newRow [ PK [ 0 ] ]
78
+ if ( PK [ 0 ] ) delete changes . newRow [ PK [ 0 ] ] ;
79
79
80
80
81
81
//iterate through and find the changes between new and old data.
82
82
const checkConstraints :tempData = { }
83
83
for ( let currentKey in tempData ) {
84
84
if ( tempData [ currentKey ] !== rowData [ currentKey ] ) {
85
- checkConstraints [ currentKey ] = tempData [ currentKey ]
85
+ checkConstraints [ currentKey ] = tempData [ currentKey ] ;
86
86
}
87
87
}
88
88
89
89
//High level idea is to prevent edits into a matching primary key of the same table.
90
90
//Change all values in set into string in order to check if changed values(string) exist in primary key constraints(string)
91
91
if ( PK [ 1 ] ) {
92
- const tempObj = [ ]
92
+ const tempObj = [ ] ;
93
93
for ( const setItem of PK [ 1 ] ) {
94
94
if ( typeof setItem === 'number' ) {
95
95
tempObj . push ( setItem . toString ( ) ) ;
96
96
PK [ 1 ] . delete ( setItem ) ;
97
97
}
98
98
}
99
- tempObj . forEach ( ( curr ) => PK [ 1 ] ?. add ( curr ) )
99
+ tempObj . forEach ( ( curr ) => PK [ 1 ] ?. add ( curr ) ) ;
100
100
101
101
for ( let currentKey in checkConstraints ) {
102
102
if ( PK [ 0 ] === currentKey && PK [ 1 ] . has ( checkConstraints [ currentKey ] ) ) {
0 commit comments