1- import { useCallback , useMemo , useState , useEffect } from "react"
1+ import { useCallback , useMemo , useState } from "react"
22import { Box , Button , Heading , ModalBody , Switch , useStyleConfig } from "@chakra-ui/react"
33import { ContinueButton } from "../../components/ContinueButton"
44import { useRsi } from "../../hooks/useRsi"
@@ -12,7 +12,7 @@ import type { themeOverrides } from "../../theme"
1212import type { RowsChangeData } from "react-data-grid"
1313
1414type Props < T extends string > = {
15- initialData : Data < T > [ ]
15+ initialData : ( Data < T > & Meta ) [ ]
1616 file : File
1717}
1818
@@ -22,20 +22,17 @@ export const ValidationStep = <T extends string>({ initialData, file }: Props<T>
2222 "ValidationStep" ,
2323 ) as ( typeof themeOverrides ) [ "components" ] [ "ValidationStep" ] [ "baseStyle" ]
2424
25- const [ data , setData ] = useState < ( Data < T > & Meta ) [ ] > ( initialData as ( Data < T > & Meta ) [ ] )
26- useEffect ( ( ) => {
27- addErrorsAndRunHooks < T > ( initialData , fields , rowHook , tableHook ) . then ( ( data ) => setData ( data ) )
28- } , [ initialData , fields , rowHook , tableHook ] )
25+ const [ data , setData ] = useState < ( Data < T > & Meta ) [ ] > ( initialData )
2926
3027 const [ selectedRows , setSelectedRows ] = useState < ReadonlySet < number | string > > ( new Set ( ) )
3128 const [ filterByErrors , setFilterByErrors ] = useState ( false )
3229 const [ showSubmitAlert , setShowSubmitAlert ] = useState ( false )
3330
3431 const updateData = useCallback (
3532 async ( rows : typeof data , indexes ?: number [ ] ) => {
36- setData ( await addErrorsAndRunHooks < T > ( rows , fields , rowHook , tableHook , indexes ) )
33+ addErrorsAndRunHooks < T > ( rows , fields , rowHook , tableHook , indexes ) . then ( ( data ) => setData ( data ) )
3734 } ,
38- [ setData , rowHook , tableHook , fields ] ,
35+ [ rowHook , tableHook , fields ] ,
3936 )
4037
4138 const deleteSelectedRows = ( ) => {
0 commit comments