2

I'm trying to make a client side only notification (data not from the server) with react and apollo-link-state as a data store I'm asking how to fetch data from cache every 2 seconds (polling) ,the data is @client state data not from the server as i said.

this is the My Query:

 const GET_NOTIF_LIST = gql`
    {
        notificationsState @client {
        notifications  {
        uid
        title
        message
        type
        position
        autodismiss
          __typename
        }
      }
    }
`;

and this is the component that should poll data from the cache only :

   render(){
     return (
       <Query query={GET_NOTIF_LIST} >
             {({ loading, error, data }) => {  
                 return (<NotificationSystemComponent  notifications={data.notificationsState.notifications || []} />)
             }}
   
       </Query>
     )
   }
  • Changes to the cache should update any components that are subscribed to them as soon as they occur, so polling the cache is unnecessary and doesn't really make sense. What are you trying to accomplish? – Daniel Rearden May 07 '18 at 12:55

0 Answers0