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:
parent
943d56d478
commit
034504c92a
2 changed files with 11 additions and 6 deletions
|
|
@ -188,8 +188,8 @@ const handleGoBack = async () => {
|
||||||
addLog(`Failed to check simulation status: ${err.message}`)
|
addLog(`Failed to check simulation status: ${err.message}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回到 Step 2 (环境搭建)
|
// 返回到 Step 2 (环境搭建), with flag so Step 2 knows to stop the sim
|
||||||
router.push({ name: 'Simulation', params: { simulationId: currentSimulationId.value } })
|
router.push({ name: 'Simulation', params: { simulationId: currentSimulationId.value }, query: { fromStep3: '1' } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleNextStep = () => {
|
const handleNextStep = () => {
|
||||||
|
|
|
||||||
|
|
@ -289,8 +289,13 @@ const refreshGraph = () => {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
addLog('SimulationView initialized')
|
addLog('SimulationView initialized')
|
||||||
|
|
||||||
// 检查并关闭正在运行的模拟(用户从 Step 3 返回时)
|
// 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()
|
await checkAndStopRunningSimulation()
|
||||||
|
// Clean up the query param
|
||||||
|
router.replace({ ...route, query: {} })
|
||||||
|
}
|
||||||
|
|
||||||
// 加载模拟数据
|
// 加载模拟数据
|
||||||
loadSimulationData()
|
loadSimulationData()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue