facebook / facebook/relay

website/docs/api-reference/graphql/graphql-directives.md: Incorrect variable use under useFragment example?

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

Description

The current code is:

https://github.com/facebook/relay/blame/f4345cb5ef8d771170649b6c01b29ce530dcde0f/website/docs/api-reference/graphql/graphql-directives.md#L174-L192

However, `item` is expected to be of type `$key`, carrying no actual object data. The data fetched from the cache is exposed to the local `data` variable.

So, this example should be either using `data.title` instead of `item.title` (and also `processItemData(data)` instead of `processItemData(item)`; or, have the input renamed to `itemRef`, and the local var to `item`, leaving the data access calls.

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.