Fix page refresh killing running simulations

SimulationView was stopping running simulations on every mount,
including page refreshes. Now only stops when user explicitly
navigates back from Step 3 via fromStep3 query param.
This commit is contained in:
_Yusaki 2026-03-13 18:40:40 +07:00
parent 943d56d478
commit 034504c92a
2 changed files with 11 additions and 6 deletions

View file

@ -188,8 +188,8 @@ const handleGoBack = async () => {
addLog(`Failed to check simulation status: ${err.message}`)
}
// Step 2 ()
router.push({ name: 'Simulation', params: { simulationId: currentSimulationId.value } })
// Step 2 (), with flag so Step 2 knows to stop the sim
router.push({ name: 'Simulation', params: { simulationId: currentSimulationId.value }, query: { fromStep3: '1' } })
}
const handleNextStep = () => {

View file

@ -288,10 +288,15 @@ const refreshGraph = () => {
onMounted(async () => {
addLog('SimulationView initialized')
// Step 3
await checkAndStopRunningSimulation()
// Only stop running simulation if user explicitly navigated back from Step 3
// (indicated by 'fromStep3' query param), not on page refresh
if (route.query.fromStep3) {
await checkAndStopRunningSimulation()
// Clean up the query param
router.replace({ ...route, query: {} })
}
//
loadSimulationData()
})