Reactjs fetchMore的问题。阿波罗客户,回应

Reactjs fetchMore的问题。阿波罗客户,回应,reactjs,graphql,apollo-client,Reactjs,Graphql,Apollo Client,我尝试通过fetchMore实现可滚动分页。Apollo server为我提供的对象如下所示: { id parameter1 parameter2 parameterN array: [...] //this array is loaded with small portions } 我实现了获取更多逻辑: const updateHandler = () => { const page = productPage + 1; fetchMore({

我尝试通过fetchMore实现可滚动分页。Apollo server为我提供的对象如下所示:

{
  id
  parameter1
  parameter2
  parameterN
  array: [...]  //this array is loaded with small portions
}
我实现了获取更多逻辑:

const updateHandler = () => {
    const page = productPage + 1;
    fetchMore({
      variables: {
        page,
      },
      updateQuery: (prevResult, { fetchMoreResult }) => {
        if (get(fetchMoreResult, tableRoute).length !== 0) {
          set(fetchMoreResult, tableRoute, [
            ...get(prevResult, tableRoute),
            ...get(fetchMoreResult, tableRoute),
          ]);
          setProductPage(page);
          return fetchMoreResult;
        }
      },
    });
  };
我的第一个问题是fetchMore不仅提供了新的部分,而且还提供了以前的结果,最终数组的行数增加了一倍。 这是我的第一个问题——为什么?如何避免呢

我决定做一些变通,并做一些函数来剪切不唯一的行。它解决了问题,但我收到了一个新的-我随机得到异常:

Unhandled Rejection (TypeError): Cannot read property '__typename' of undefined
getTypenameFromResult
C:/Users/polev/src/utilities/graphql/storeUtils.ts:260
Policies.identify
C:/Users/polev/src/cache/inmemory/policies.ts:281
这是什么?为什么我会得到它