|
|
|
|
@ -20,14 +20,21 @@ const Dashboard = () => {
|
|
|
|
|
const [currentFuture, setCurrentFuture] = useState(null);
|
|
|
|
|
const [pushForm] = Form.useForm();
|
|
|
|
|
const [messageApi, contextHolder] = message.useMessage();
|
|
|
|
|
|
|
|
|
|
// 添加ref来避免在开发模式下的重复API请求
|
|
|
|
|
const fetchingRef = React.useRef(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
dispatch(fetchFuturesOverview());
|
|
|
|
|
dispatch(fetchRiskAlerts());
|
|
|
|
|
dispatch(fetchAIMarketAnalysis());
|
|
|
|
|
if (!fetchingRef.current) {
|
|
|
|
|
fetchingRef.current = true;
|
|
|
|
|
dispatch(fetchFuturesOverview());
|
|
|
|
|
dispatch(fetchRiskAlerts());
|
|
|
|
|
dispatch(fetchAIMarketAnalysis());
|
|
|
|
|
}
|
|
|
|
|
}, [dispatch]);
|
|
|
|
|
|
|
|
|
|
const handleRefresh = () => {
|
|
|
|
|
fetchingRef.current = false;
|
|
|
|
|
dispatch(fetchFuturesOverview());
|
|
|
|
|
dispatch(fetchRiskAlerts());
|
|
|
|
|
dispatch(fetchAIMarketAnalysis());
|
|
|
|
|
|