|
|
@@ -119,8 +119,10 @@ const Statistics: React.FC<StatisticsProps> = () => {
|
|
|
// 下拉刷新:刷新所有统计数据
|
|
|
usePullDownRefresh(async () => {
|
|
|
try {
|
|
|
- // refetchQueries 会等待所有查询完成后才返回
|
|
|
- await queryClient.refetchQueries({ queryKey: ['statistics'] })
|
|
|
+ // invalidateQueries 标记所有统计查询为过期,触发重新请求
|
|
|
+ await queryClient.invalidateQueries({ queryKey: ['statistics'] })
|
|
|
+ // 等待请求完成(统计数据有9个API,需要一定时间)
|
|
|
+ await new Promise(resolve => setTimeout(resolve, 1500))
|
|
|
} finally {
|
|
|
Taro.stopPullDownRefresh()
|
|
|
}
|