1- import React , { useState } from 'react' ;
1+ import React , { useState , useEffect } from 'react' ;
22import { toast } from 'react-toastify' ;
33import axios from 'axios' ;
44import { EXECUTION_ENGINE_URL } from '../../serverCon/config' ;
@@ -10,13 +10,25 @@ const ContributeDetails = ({ superState, dispatcher }) => {
1010 const closeModal = ( ) => {
1111 dispatcher ( { type : T . SET_CONTRIBUTE_MODAL , payload : false } ) ;
1212 } ;
13- const [ study , setStudy ] = useState ( '' ) ;
14- const [ path , setPath ] = useState ( '' ) ;
15- const [ auth , setAuth ] = useState ( '' ) ;
13+
14+ const curGraph = superState . graphs [ superState . curGraphIndex ] ?? { } ;
15+
16+ const [ study , setStudy ] = useState ( curGraph . projectName ?? '' ) ;
17+ const [ path , setPath ] = useState ( superState . uploadedDirName ?? '' ) ;
18+ const [ auth , setAuth ] = useState ( curGraph . authorName ?? '' ) ;
1619 const [ title , setTitle ] = useState ( '' ) ;
1720 const [ desc , setDesc ] = useState ( '' ) ;
1821 const [ branch , setBranch ] = useState ( '' ) ;
1922 const [ showAdvanceOptions , setShowAdvanceOptions ] = useState ( false ) ;
23+
24+ useEffect ( ( ) => {
25+ if ( superState . contributeModal ) {
26+ const activeGraph = superState . graphs [ superState . curGraphIndex ] ?? { } ;
27+ setStudy ( activeGraph . projectName ?? '' ) ;
28+ setPath ( superState . uploadedDirName ?? '' ) ;
29+ setAuth ( activeGraph . authorName ?? '' ) ;
30+ }
31+ } , [ superState . contributeModal ] ) ;
2032 const submit = async ( e ) => {
2133 if ( study === '' || path === '' || auth === '' ) {
2234 toast . info ( 'Please Provide necessary inputs' ) ;
0 commit comments