facebook / facebook/relay

Hooks without Suspense

Open
#5,017 0 comments 1 reaction 0 assignees View on GitHub
shared with relay team
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Considering Suspense now works on the server, which makes server side rendered components with Relay data fetching a little more complicated to setup in nextjs apps, would it be a good idea to add Suspense-less hooks? I know that ideally there should be 1 query per screen, and we have already figured out how to prefetch these in server components and hydrate on the client, however sometimes you may have smaller components that make their own queries like widgets for example. Now, we would either need to also remember to prefetch each of these in the server, or risk it fetching on the server and then on the client and potentially also have a hydration mismatch due to different responses. I'm thinking that for these a hook that does not suspend would be extremely useful to sort of imply this is a client only component. I wrote one based on `fetchQuery` and have really liked it so far, but I'm wondering if this is something Relay should support out of the box. Happy to contribute if this is something of interest.

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.