update pay ui
This commit is contained in:
@@ -22,11 +22,13 @@ export const useHotspotData = (selectedDate) => {
|
||||
// 获取日期字符串用于比较
|
||||
const dateStr = selectedDate ? selectedDate.toISOString().split('T')[0] : 'today';
|
||||
|
||||
// 如果正在请求中,或者日期未变化且不是强制刷新,跳过
|
||||
// 如果正在请求中,跳过(除非是强制刷新)
|
||||
if (fetchingRef.current && !forceRefetch) {
|
||||
return;
|
||||
}
|
||||
if (lastDateRef.current === dateStr && data && !forceRefetch) {
|
||||
|
||||
// 如果日期未变化且已有数据,跳过(除非是强制刷新)
|
||||
if (lastDateRef.current === dateStr && !forceRefetch) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +56,7 @@ export const useHotspotData = (selectedDate) => {
|
||||
setLoading(false);
|
||||
fetchingRef.current = false;
|
||||
}
|
||||
}, [selectedDate, data]);
|
||||
}, [selectedDate]); // 移除 data 依赖,避免循环更新
|
||||
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
|
||||
Reference in New Issue
Block a user