React Native & RTK Query - IsLoading on refetch 方法

React Native & RTK Query - IsLoading on refetch method

为什么当我在下面的代码中使用 refetch 方法时,isLoading 值在获取期间 true 上没有 return?

const [matchFilterSelected, setMatchFilterSelected] = useState('explorer')

// Query declaration
const {
  data: matches,
  refetch,
  error: matchesError,
  isLoading: matchesIsLoading,
} = useFetchMatchesQuery(matchFilterSelected)

// Callback function from onPress event
const filterSelectedChanged = (matchesType) => {
  if (matchesType && matchesType !== matchFilterSelected) {
    setMatchFilterSelected(matchesType)
    refetch()
  }
}

不,isLoading 仅在初始加载时为真。您可能想使用 isFetching - 显示实际 activity.