Skip to content

Commit

Permalink
Fix flicker and auto-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed Sep 1, 2023
1 parent 6a19d42 commit 3b905a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions components/LoadLFortran.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ function LoadLFortran({
lfortran_funcs,
openNotification,
myPrint,
handleUserTabChange
}) {

const { basePath } = useRouter();
Expand All @@ -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 (
Expand Down
7 changes: 4 additions & 3 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand All @@ -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;
Expand All @@ -82,6 +83,7 @@ export default function Home() {
} else {
setSourceCode(preinstalled_programs.basic.mandelbrot);
}
setDataFetch(true);
}

async function handleUserTabChange(key) {
Expand Down Expand Up @@ -152,7 +154,6 @@ export default function Home() {
lfortran_funcs={lfortran_funcs}
openNotification={openNotification}
myPrint={setOutput}
handleUserTabChange={handleUserTabChange}
></LoadLFortran>

<Row gutter={[16, 16]}>
Expand Down

0 comments on commit 3b905a2

Please sign in to comment.