@@ -13,6 +13,8 @@ const NodeDetails = ({
1313 const [ widthSet ] = useState ( false ) ;
1414 const [ labelName , setLabelName ] = useState ( '' ) ;
1515 const [ labelFile , setLabelFile ] = useState ( '' ) ;
16+ const indexOfFile = [ ] ;
17+ indexOfFile . push ( 0 ) ;
1618
1719 const setStyle = ( prop ) => {
1820 setData ( { ...data , style : { ...data . style , ...prop } } ) ;
@@ -117,14 +119,17 @@ const NodeDetails = ({
117119 {
118120 localStorageManager . getFileList ( )
119121 // eslint-disable-next-line max-len, prefer-arrow-callback
120- ? JSON . parse ( localStorageManager . getFileList ( ) ) . map ( function fn ( item , index ) {
122+ ? JSON . parse ( localStorageManager . getFileList ( ) ) . map ( function fn ( item ) {
121123 const acceptedTypes = [ '.v' , '.c' , '.cpp' , '.py' , '.m' , '.sh' ] ;
122124 const list = [ ] ;
125+ let index ;
123126 // eslint-disable-next-line max-len
124127 if ( ( acceptedTypes . some ( ( substring ) => item . key . toString ( ) . includes ( substring ) ) ) ) {
125128 list . push ( item . key . toString ( ) ) ;
129+ indexOfFile . push ( indexOfFile [ indexOfFile . length - 1 ] + 1 ) ;
130+ index = indexOfFile [ indexOfFile . length - 1 ] + 1 ;
126131 }
127- // eslint-disable-next-line jsx-a11y/control-has-associated-label, react/no-array-index-key
132+ // eslint-disable-next-line jsx-a11y/control-has-associated-label
128133 return < option value = { list } key = { index } /> ;
129134 } )
130135 : ''
0 commit comments