This content originally appeared on DEV Community and was authored by SeongKuk Han
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();
};
}, []);
This content originally appeared on DEV Community and was authored by SeongKuk Han
SeongKuk Han | Sciencx (2022-02-15T08:45:09+00:00) React Apollo: useQuery pollInterval with cache-and-network doesn’t stop to make requests after unmounting a component. Retrieved from https://www.scien.cx/2022/02/15/react-apollo-usequery-pollinterval-with-cache-and-network-doesnt-stop-to-make-requests-after-unmounting-a-component/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.