facebook / facebook/relay

Bug: Polling does not stop after a component is unmounted

Open
#4,092 2 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

## Issue
I'm trying to switch from Apollo Client to Relay, but running into an issue with polling queries. Polling does not stop after the component is unmounted.

Example code:
```
const query = useLazyLoadQuery(
TodoAppQuery.default,
{
userId: "me"
},
{
networkCacheConfig: {
poll: 1_000
}
}
);
```

## Expected behavior
Polling to stop after the component is unmounted.

Bug Repo - https://codesandbox.io/s/happy-hamilton-29f8r0?file=/src/PageTwo.tsx

```
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-relay": "^14.1.0",
"relay-runtime": "^14.1.0"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.