【发布时间】:2018-01-16 01:36:12
【问题描述】:
我正在尝试从我的 apollo 本地缓存 (InMemoryCache) 中查询所有实体,但没有成功。
这是我的操作方式。
query EntityList($limit: Int!, $offset: Int!) {
entities(
limit: $limit,
offset: $offset
) {
__typename
EntityId
}
}
有了这个查询:没问题。 但后来,我想从缓存中查询所有实体,不带任何参数。
query LocalEntityList {
entities {
EntityId
}
}
这个简单的代码触发了一个错误
Can't find field entities on object (ROOT_QUERY)....
通过documentation site,我了解到我需要在InMemoryCache 对象上使用cacheResolvers 选项。
但是没有不传递 id 作为参数的例子。
【问题讨论】:
标签: apollo react-apollo apollo-client