我正在尝试使用react和apollo-link-state作为数据存储,只做客户端通知(数据不是来自服务器)我问的是如何每2秒从缓存中获取数据(轮询),数据是@client状态数据不是来自服务器,正如我所说 .
this is the My Query:
const GET_NOTIF_LIST = gql`
{
notificationsState @client {
notifications {
uid
title
message
type
position
autodismiss
__typename
}
}
}
`;
这是应该仅从缓存中轮询数据的组件:
render(){
return (
<Query query={GET_NOTIF_LIST} >
{({ loading, error, data }) => {
return (<NotificationSystemComponent notifications={data.notificationsState.notifications || []} />)
}}
</Query>
)
}