facebook / facebook/relay

Refetch only missing field with node resolver

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

Description

As far as I can see, it's not possible to just refetch a single resolved field on a Node (type that implements the `Node` interface). So when using partially cached data, it's possible to first render the present data, but then the whole parent query is queried afterwards even though only one specific field was missing.

I managed to narrow down the missing field with `missingFieldHandlers`, but at a specific point, there's actually missing data. I agree that this aligns with [what the docs state](https://relay.dev/docs/guided-tour/reusing-cached-data/rendering-partially-cached-data/#:~:text=When%20the%20UsernameComponent,fragments%2C%20is%20missing.).

Is there an option to tell Relay to only refetch the missing field and not the _whole_ query if there is missing data?

Contributor guide

Open the contributing guide

Research direction

Start by reading the partially cached data guidance linked in the issue and tracing how missingFieldHandlers interact with Node resolvers. The issue names no source file or test; done would be a clear determination of whether field-only refetching is supported, with the behavior captured in an appropriate test or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript, react
Domain
api, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.