diff --git a/frontend/src/hooks/simulation/useSimulations.ts b/frontend/src/hooks/simulation/useSimulations.ts index c51fbc5..60d6124 100644 --- a/frontend/src/hooks/simulation/useSimulations.ts +++ b/frontend/src/hooks/simulation/useSimulations.ts @@ -5,7 +5,7 @@ import evaluator from '@/modules/evaluator'; import type { SimulationInput, SimulationResult } from './types'; export const useSimulations = () => { - const [simulations, setSimulations] = useState([ + const [simulationInputs, setSimulationInputs] = useState([ { id: 1, input: '' }, { id: 2, input: '' }, { id: 3, input: '' }, @@ -49,7 +49,9 @@ export const useSimulations = () => { }, []); function runSimulation(code: string) { - const tasks = simulations.map(({ id, input }) => evaluator.createEvalMessage(id, code, input)); + const tasks = simulationInputs.map(({ id, input }) => + evaluator.createEvalMessage(id, code, input), + ); const isRequestSuccess = evaluator.evaluate(tasks); @@ -61,18 +63,18 @@ export const useSimulations = () => { return simulResults .map((simul, index) => ({ ...simul, - input: simulations[index].input, + input: simulationInputs[index].input, })) .map(toEvaluatingState); }); } function changeInput(targetId: number, newParam: string) { - const changedSimulation = simulations.find(({ id }) => id === targetId); + const changedSimulation = simulationInputs.find(({ id }) => id === targetId); if (changedSimulation) { changedSimulation.input = newParam; } - setSimulations([...simulations]); + setSimulationInputs([...simulationInputs]); } function cancelSimulation() { @@ -80,7 +82,7 @@ export const useSimulations = () => { } return { - simulations, + simulationInputs, simulationResults, isSimulating, runSimulation, diff --git a/frontend/src/pages/ContestPage.tsx b/frontend/src/pages/ContestPage.tsx index 0a7eb72..0346d9c 100644 --- a/frontend/src/pages/ContestPage.tsx +++ b/frontend/src/pages/ContestPage.tsx @@ -29,7 +29,7 @@ const CANCEL_SIMULATION = '실행 취소'; export default function ContestPage() { const CONTEST_NAME = 'Test'; // api로 받을 정보 const { - simulations, + simulationInputs, simulationResults, isSimulating, runSimulation, @@ -70,7 +70,7 @@ export default function ContestPage() {