diff --git a/src/components/run/RunSettings.tsx b/src/components/run/RunSettings.tsx index a35d2f28..33427d16 100644 --- a/src/components/run/RunSettings.tsx +++ b/src/components/run/RunSettings.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect, useRef } from "react"; import { GenericModal } from "../ui/GenericModal"; import { MenuItem, TextField, Typography, Switch, FormControlLabel } from "@mui/material"; import { Dropdown } from "../ui/DropdownMui"; @@ -28,6 +28,23 @@ export const RunSettingsModal = ({ isOpen, handleStart, handleClose, isTask, par }); const [showInterpreterSettings, setShowInterpreterSettings] = useState(false); + const hasRun = useRef(false); + + useEffect(() => { + if (!isOpen) { + hasRun.current = false; + return; + } + + if (!showInterpreterSettings && !hasRun.current) { + hasRun.current = true; + handleStart(settings); + } + }, [isOpen, showInterpreterSettings, settings, handleStart]); + + if (!showInterpreterSettings) { + return null; + } return ( -
+
{isTask && ( - Recording parameters: + + Recording parameters: + {params?.map((item, index) => ( setShowInterpreterSettings(!showInterpreterSettings)} />} + control={ + + setShowInterpreterSettings(!showInterpreterSettings) + } + /> + } label="Developer Mode Settings" - sx={{ margin: '20px 0px' }} + sx={{ margin: "20px 0px" }} /> {showInterpreterSettings && ( )} - +
);