Angular 阿波罗分页角度图
有人能提供一个使用Apollo Client 3.0字段策略实现分页的示例吗。我一直遵循文档中的示例来实现无限滚动,但在我的控制台中,我收到了以下警告: fetchMore的updateQuery回调已弃用,将被删除 在阿波罗客户端的下一个主要版本中 请将updateQuery函数转换为具有适当 读取和合并函数,或使用/调整辅助函数(例如 合并分页、偏移限制分页或重新分页) @阿波罗/客户/公用事业公司 field policy系统比 手工编写的updateQuery函数,您只需要定义策略 一次,而不是每次你打电话给fetchMore 所以我尝试用一种新的Apollo方法实现分页 list.component.ts //getOffers()在OnInit()中运行 //graphql.moduleAngular 阿波罗分页角度图,angular,pagination,graphql,apollo,Angular,Pagination,Graphql,Apollo,有人能提供一个使用Apollo Client 3.0字段策略实现分页的示例吗。我一直遵循文档中的示例来实现无限滚动,但在我的控制台中,我收到了以下警告: fetchMore的updateQuery回调已弃用,将被删除 在阿波罗客户端的下一个主要版本中 请将updateQuery函数转换为具有适当 读取和合并函数,或使用/调整辅助函数(例如 合并分页、偏移限制分页或重新分页) @阿波罗/客户/公用事业公司 field policy系统比 手工编写的updateQuery函数,您只需要定义策略 一次
const cache = new InMemoryCache({
typePolicies: {
Query: {
fields: {
// Keep searches separated by args.query (but not by any other
// arguments, since the field policy will handle them).
offers: offsetLimitPagination(),
},
},
},
});
现在,当我从InMemoryCache中删除带有TypePolicys的部分时,我的提供列表将被加载,但fetchMore()不会返回任何内容。使用TypePolicys时,既不会加载列表,也不会使用fetchMore()。有人能给我提供正确的方法使分页工作吗
const cache = new InMemoryCache({
typePolicies: {
Query: {
fields: {
// Keep searches separated by args.query (but not by any other
// arguments, since the field policy will handle them).
offers: offsetLimitPagination(),
},
},
},
});