Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 阿波罗3号分页,带有开始和限制更多和字段策略_Reactjs_React Native_Graphql_Apollo_Strapi - Fatal编程技术网

Reactjs 阿波罗3号分页,带有开始和限制更多和字段策略

Reactjs 阿波罗3号分页,带有开始和限制更多和字段策略,reactjs,react-native,graphql,apollo,strapi,Reactjs,React Native,Graphql,Apollo,Strapi,我正在使用fetchmMore Apollo函数,如下所示: const { data: data_next_drops, loading: loading_next_drops, error: error_next_drops, fetchMore: fetchMoreNext, refetch: refetchNext } = useQuery(GET_ALL_NEXT_DROPS, { variables: { date

我正在使用fetchmMore Apollo函数,如下所示:

  const {
    data: data_next_drops,
    loading: loading_next_drops,
    error: error_next_drops,
    fetchMore: fetchMoreNext,
    refetch: refetchNext
  } = useQuery(GET_ALL_NEXT_DROPS, {
    variables: { 
      date: date,      
      limit: limit,
      start: starte
    },
  });

  const loadMore = async () => {
    setLoading(true)
    fetchMoreNext({
      variables: {
        date: date,      
        limit: 10,
        start: Skip
      },
      updateQuery: (preveResult, {fetchMoreResult}) => {
        setSkip(Skip+limit)
        fetchMoreResult.drops = [
          ...preveResult.drops,
          ...fetchMoreResult.drops
        ]
        setLoading(false)
        return fetchMoreResult;
      }
    })  
  }
但我有一个警告:

    The updateQuery callback for fetchMore is deprecated, and will be removed
in the next major version of Apollo Client.

Please convert updateQuery functions to field policies with appropriate
read and merge functions, or use/adapt a helper function (such as
concatPagination, offsetLimitPagination, or relayStylePagination) from
@apollo/client/utilities.

The field policy system handles pagination more effectively than a
hand-written updateQuery function, and you only need to define the policy
once, rather than every time you call fetchMore.
正如你们所看到的,我在分页时使用了限制和开始,所以我认为我不能使用偏移限制分页或RelayStyle分页,所以可以使用concatPagination吗?或者有没有其他方法


提前谢谢你

警告只是告诉您将
updateQuery
函数移出到
InMemoryCache

请看(完整地阅读,我第一次错过了一些重要信息),或者因为我有一个无关的问题,使我用一个与您非常接近的工作示例制作了这个