facebook / facebook/relay

`refetch({}, "network-only")` suspends, even when inside `startTransition`

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

Description

## Reporting issues with Relay

`refetch({}, "network-only")` always causes React to suspend, even when inside `startTransition`. This is annoying, specially when rendering lists with `usePaginationFragment`, where you would want to show the existing items, while re-fetching the new ones, and not jump to a suspend boundary. Furthermore, I think the difference in behavior for different `FetchPolicy`s is not that intuitive for a beginner. And `loadNext`, for example, will never suspend. I think everything that makes a network request should suspend, to avoid these confusions, and the user should be able to opt out of it with `startTransition`. This was the approach Apollo took (https://github.com/apollographql/apollo-client/issues/10676).

I realize this might be too dramatic of a change, but at least we should be able to use `startTransition` to prevent `refetch` from suspending.

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.