From 9e069a54ef563ac645c464a87b6def7f3a5ced74 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Wed, 9 Apr 2025 21:30:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=AE=8C=E6=88=90=E5=90=8E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=B1=80/=E6=AE=B5/=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 8066faf..d8cce3b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -73,21 +73,24 @@ function App() { return Toast.show(res.message); } if (res.data.needSync) { - dispatch(syncBaseData()) - .unwrap() - .then((res) => { - if (res.success) { - dispatch(fetchOrgTree()); - } else { - Toast.show(res.message); - } - }); + dispatch(syncBaseData()); } else { dispatch(fetchOrgTree()); } }); }, [dispatch]); + // 同步完成后,重新获取局/段/线信息 + useEffect(() => { + if ( + baseState.syncBaseProgress.finish && + !baseState.syncBaseProgress.error && + baseState.syncBaseProgress.progress === 100 + ) { + dispatch(fetchOrgTree()); + } + }, [baseState.syncBaseProgress, dispatch]); + // 预获取车站信息 useEffect(() => { if (contextState.currXMCode) {