facebook / facebook/relay

How do we do server-side rendering with Relay Modern?

Open
#1,881 63 comments 40 reactions 0 assignees View on GitHub
docs
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

This is sort of a follow-up to https://github.com/facebook/relay/issues/1687 and https://github.com/facebook/relay/pull/1760.

What is a recommended pattern for handling server-side rendering in a simple request-response paradigm with Relay Modern?

`RecordStore` seems to expose capabilities for serializing and deserializing its contents, and I can use a preloaded `RecordStore` when building a new `Environment`, but this is a bit deceptive, since without https://github.com/facebook/relay/pull/1760, my ``s will ignore the preloaded records... but this capability must be there for a reason?

But thinking about this more, I'm not even sure the approach in #1760 is correct. For a streaming network layer, it seems like it would be wrong to omit sending out the request just because I have preloaded data – instead I'd just want the server to e.g. not send me the initial payload (because I already have it).

Something like the query response cache seems more promising, but the bundled one doesn't really expose hooks for exporting its contents, plus a key/value cache with a TTL isn't exactly the right model here anyway.

Am I missing something?

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.