facebook / facebook/relay

FetchQuery with "network-only" is not ephemeral.

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

Description

Hi team,

I was wondering if you could help me with an issue that I have with `fetchQuery`

We have a very custom component that uses fetchQuery to get the data from the server, and then we manually take the connection edgess and update different connection. (There is some reason for this madness, we are implementing quite complicated component that tries to paginate and expand/collapse tree - imagine file system with folders).

I use the fetchQuery with cache-config parameter "network-only". When this query is fetched for the first time, everything works. When I fetch it for the second time (with the same parameters), it however reaches out to cache and tries to reconcile data with the previous request.

When I try to debug things, what I see is that the `update` on the ConnectionHandler is behaving differently for the first call and for the second one:

![Screenshot 2023-10-10 at 13 58 00](https://github.com/facebook/relay/assets/84394702/a22c4364-6431-4f82-8503-eb85b4cee08b)

In the first run, the clientConnection is undefined, but for the second time, it is already defined. That is quite surprising, because I would expect that the first request is ephemeral and calling the same query multiple times will always behave like it was called for the first time.

I even set the gcReleaseBufferSize to 0 with hope it will be garbage collected, but for some reason it keeps hanging around.

Do you have any tips how to get the store to the state before the request was made so that relay thinks when I call it again, it's being called for the first time?

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.