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) {