我有以下订阅,但是当我收到某些内容并尝试更新查询时,它将被删除。知道我在这做错了什么吗?除此以外,我所有的订阅都运行良好,唯一的区别是我收到的是数组而不是对象。
if (nextProps.getSkills && !nextProps.getSkills.loading) {
let { subscribeToMore } = this.props.getSkills;
subscribeToMore({
document: SKILLS_ENDORSED_SUBSCRIPTION,
updateQuery: (prev, { subscriptionData }) => {
if (!subscriptionData.data) {
return prev;
}
const endorsedSkills = subscriptionData.data.skillsEndorsed;
if (endorsedSkills) {
return {
...prev,
getUserSkills: [...endorsedSkills, ...prev.getUserSkills]
};
}
return prev;
},
onError: err => console.log(err)
});
}
我的更新查询
Object {
"error": undefined,
"fetchMore": [Function bound ],
"getUserSkills": Array [], // When I update this will be removed
"loading": false,
"networkStatus": 7,
"refetch": [Function bound ],
"startPolling": [Function bound ],
"stopPolling": [Function bound ],
"subscribeToMore": [Function bound ],
"updateQuery": [Function bound ],
"variables": Object {},
}