facebook / facebook/relay

useRefetchableFragment refetch disposable doesn't cancel network request

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

Description

As per the title, I have looked at the [documents ](https://relay.dev/docs/next/api-reference/use-refetchable-fragment/) which states:

`disposable: Object containing a dispose function. Calling disposable.dispose() will cancel the refetch request.`

But I cannot seem to get the request to cancel. In my use case, I have a date picker which you can toggle next/prev. When click next multiple times, it will send out multiple network requests instead of cancelling the previous request.

I use an effect hook and return the dispose callback and using console log I can see the component unmounts so it should be getting called.

I also tried calling dispose immedietly. `refetch({}).dispose()` and that didn't work either.

I am using Relay 15.

Any pointers please?

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.