Apollo gql, get loading state when polling

Apollo gql, get loading state when polling


0

I am using @apollo/client v3. I want to get loading state when requests will happen from polling but it is not working as I expect.

This is my query

  const { data, loading } = useQuery(SOME_QUERY, {
    variables: {
      variable: "value",
    },
    10000  //poll interval
  });

I wrote useEffect to catch if it is loading or not when polling

  useEffect(() => {
    console.log(loading)
  }, [loading]);

This is runs only for first request but in browsers network tab I see that requests is happening every 10seconds (10000 milliseconds, because of polling). How can I catch state when loading is happening or polling is started for all requests?


Load 3 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *