An Interest In:
Web News this Week
- April 15, 2024
- April 14, 2024
- April 13, 2024
- April 12, 2024
- April 11, 2024
- April 10, 2024
- April 9, 2024
February 15, 2022 08:45 am GMT
Original Link: https://dev.to/lico/usequery-pollinterval-with-cache-and-network-doesnt-stop-to-make-requests-after-unmounting-a-component-4hp8
React Apollo: useQuery pollInterval with cache-and-network doesn't stop to make requests after unmounting a component
I've made the issue here in apollo-client repository.
It works well with other fetchPolicy
options but it doens't work correctly with cache-and-network
.
Before resolving the issue, here is one of the alternatives.
alternative
Starting polling manually
const { data: todosData, error, startPolling, stopPolling, } = useQuery(GET_TODOS, { fetchPolicy: "cache-and-network", }); useEffect(() => { startPolling(1000); // poll interval return () => { stopPolling(); }; }, []);
Original Link: https://dev.to/lico/usequery-pollinterval-with-cache-and-network-doesnt-stop-to-make-requests-after-unmounting-a-component-4hp8
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To