RevereCRE / relay-nextjs

⚡️ Relay integration for Next.js apps
https://reverecre.github.io/relay-nextjs/
MIT License
251 stars 30 forks source link

feat: cache config from context #95

Closed Meemaw closed 11 months ago

Meemaw commented 11 months ago

Add support for providing cacheConfig from context. This can be useful for a few reasons:

Note that its possible to achieve 2. today with variablesFromContext as well, but its a bit more annoying, because we don't want to send that as an actual variable to the graphql endpoint, we might want to do some conditional logic based on metadata, or send special headers.

rrdelaney commented 11 months ago

@Meemaw This is a great idea for a feature, and after discussing internally we combined it with fetchPolicy into a new queryOptionsFromContext configuration. This lets you specify any configuration to loadQuery based on ctx and should satisfy this feature as well. We just released this in v3.0.0, can you please test this out and let us know if it works for you? Thanks!

Meemaw commented 10 months ago

@rrdelaney that works, thanks!