diff --git a/components/LoadLFortran.js b/components/LoadLFortran.js index 96e8505..b82e2c7 100644 --- a/components/LoadLFortran.js +++ b/components/LoadLFortran.js @@ -162,7 +162,6 @@ function LoadLFortran({ lfortran_funcs, openNotification, myPrint, - handleUserTabChange }) { const { basePath } = useRouter(); @@ -179,7 +178,6 @@ function LoadLFortran({ setModuleReady(true); openNotification("LFortran Module Initialized!", "bottomRight"); console.log("LFortran Module Initialized!"); - handleUserTabChange("STDOUT"); }, [moduleReady]); // update the callback if the state changes return ( diff --git a/pages/index.js b/pages/index.js index 2b5ce2c..8caed60 100644 --- a/pages/index.js +++ b/pages/index.js @@ -45,6 +45,7 @@ export default function Home() { const [exampleName, setExampleName] = useState("main"); const [activeTab, setActiveTab] = useState("STDOUT"); const [output, setOutput] = useState(""); + const [dataFetch, setDataFetch] = useState(false); const isMobile = useIsMobile(); const myHeight = ((!isMobile) ? "calc(100vh - 170px)" : "calc(50vh - 85px)"); @@ -54,8 +55,8 @@ export default function Home() { }, []); useEffect(() => { - if(moduleReady){handleUserTabChange("STDOUT"); } - }, [moduleReady]); + if(moduleReady) { handleUserTabChange("STDOUT"); } + }, [moduleReady, dataFetch]); async function fetchData() { const url = window.location.search; @@ -82,6 +83,7 @@ export default function Home() { } else { setSourceCode(preinstalled_programs.basic.mandelbrot); } + setDataFetch(true); } async function handleUserTabChange(key) { @@ -152,7 +154,6 @@ export default function Home() { lfortran_funcs={lfortran_funcs} openNotification={openNotification} myPrint={setOutput} - handleUserTabChange={handleUserTabChange} >