fix: 修复开发模式下,首页请求两次的问题

master
Lxy 3 months ago
parent 02606aeaad
commit c8329f0d07

@ -21,13 +21,20 @@ const Dashboard = () => {
const [pushForm] = Form.useForm(); const [pushForm] = Form.useForm();
const [messageApi, contextHolder] = message.useMessage(); const [messageApi, contextHolder] = message.useMessage();
// refAPI
const fetchingRef = React.useRef(false);
useEffect(() => { useEffect(() => {
if (!fetchingRef.current) {
fetchingRef.current = true;
dispatch(fetchFuturesOverview()); dispatch(fetchFuturesOverview());
dispatch(fetchRiskAlerts()); dispatch(fetchRiskAlerts());
dispatch(fetchAIMarketAnalysis()); dispatch(fetchAIMarketAnalysis());
}
}, [dispatch]); }, [dispatch]);
const handleRefresh = () => { const handleRefresh = () => {
fetchingRef.current = false;
dispatch(fetchFuturesOverview()); dispatch(fetchFuturesOverview());
dispatch(fetchRiskAlerts()); dispatch(fetchRiskAlerts());
dispatch(fetchAIMarketAnalysis()); dispatch(fetchAIMarketAnalysis());

Loading…
Cancel
Save