代码是这样的。我遵循的是apollo-link-state的例子。
const defaultState = {
"appStateOfUI": {
__typename: "appStateOfUI",
first: "John",
last: "Doe"
}
};我们使用如下默认值预热客户端:
const stateLink = withClientState({
cache,
defaults: defaultState,
resolvers: {
Mutation: {
updateAppState: ...
}
}
});并像这样初始化我的客户端。
const client = new ApolloClient({
link: ApolloLink.from([
stateLink,
new HttpLink({...})
]),
cache
});一切都很正常。但我不明白为什么我的不能工作。
在花了相当长的时间后,我发现一些实用程序在库的一端被破坏了,人们建议回滚。在其他thread中是黑客攻击/修复。只是想在这里分享一下,这样其他人也能从中受益。
发布于 2018-02-02 14:52:53
FIX:像这样修改您的默认值appStateOfUI@client -通过在属性中包含client with。它应该看起来像这样:
const defaultState = {
"appStateOfUI@client": {
__typename: "appStateOfUI",
first: "John",
last: "Doe"
}
};剩下的都是一样的。
https://stackoverflow.com/questions/48577218
复制相似问题