|
|
@@ -119,10 +119,11 @@ const Statistics: React.FC<StatisticsProps> = () => {
|
|
|
// 下拉刷新:刷新所有统计数据
|
|
|
usePullDownRefresh(async () => {
|
|
|
try {
|
|
|
- // invalidateQueries 标记所有统计查询为过期,触发重新请求
|
|
|
- await queryClient.invalidateQueries({ queryKey: ['statistics'] })
|
|
|
- // 等待请求完成(统计数据有9个API,需要一定时间)
|
|
|
- await new Promise(resolve => setTimeout(resolve, 1500))
|
|
|
+ // refetchQueries + type: 'all' 强制刷新所有统计查询(包括 inactive 的懒加载图表)
|
|
|
+ await queryClient.refetchQueries({
|
|
|
+ queryKey: ['statistics'],
|
|
|
+ type: 'all' // 刷新所有匹配的查询,包括 inactive 的
|
|
|
+ })
|
|
|
} finally {
|
|
|
Taro.stopPullDownRefresh()
|
|
|
}
|