Support readInlineData with @relay(plural: true) Fragments
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Despite spread the fragment in the parent that is passing the ref to the function, you get a runtime error when attempting to use `readInlineData` on a Fragment that uses the `plural: true` directive such as:
```js
function filter(itemsRef) {
const items = readInlineData(
graphql`
fragment ItemList_items on Item @relay(plural: true) {
name
}
`,
itemsRef
);
// process
}
```
Error:
```
readInlineData(): Expected fragment `ItemList_items` to be spread in the parent fragment.
```
I also tried mapping with `readInlineData`, but that didn't work either:
```js
function filter(itemsRef) {
const items = itemsRef.map(i => readInlineData(
graphql`
fragment ItemList_items on Item @relay(plural: true) {
name
}
`,
i
);
// process
}
```
Presumably `readInlineData` is expecting an object that contains a specific fragment ref key rather than an array of fragments.
Contributor guide
Assessment
This issue has not been assessed yet.