|
|
@@ -117,14 +117,20 @@ const Statistics: React.FC<StatisticsProps> = () => {
|
|
|
}, [])
|
|
|
|
|
|
// 下拉刷新:刷新所有统计数据
|
|
|
+ // 使用 Promise.all 精确 invalidate 每个 queryKey,确保所有查询都被触发
|
|
|
usePullDownRefresh(async () => {
|
|
|
try {
|
|
|
- // invalidateQueries + refetchType: 'all' 强制刷新所有查询(包括 inactive 的)
|
|
|
- // refetchQueries 无法刷新 disabled (enabled: false) 的查询
|
|
|
- await queryClient.invalidateQueries({
|
|
|
- queryKey: ['statistics'],
|
|
|
- refetchType: 'all' // 刷新所有匹配的查询,包括 inactive 的
|
|
|
- })
|
|
|
+ await Promise.all([
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'employment-count'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'average-salary'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'employment-rate'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'disability-type-distribution'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'gender-distribution'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'age-distribution'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'household-distribution'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'job-status-distribution'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['statistics', 'salary-distribution'] }),
|
|
|
+ ])
|
|
|
} finally {
|
|
|
Taro.stopPullDownRefresh()
|
|
|
}
|