I have parent component that ends up with nested fragments looking like this:
query MyAppQuery(
$id
$a
$b
$c
) {
viewer {
...App_viewer
...ComponentA_viewer @include(if: $a)
...ComponentB_viewer @include(if: $b)
...ComponentC_viewer @include(if: $c)
}
allEmployees: allUsers(userType: "1") {
...ComponentA_allEmployees @include(if: $a)
...ComponentB_allEmployees @include(if: $b)
...ComponentC_allEmployees @include(if: $c)
}
};
Relay fails if I don't include all this child fragments but the data is the same for all these, it seems pretty dumb having to declare a view fragment on all my child components that require the signed in user.
How can I request this piece of data at the top of my application and have it available to child components without having to include the all these fragments.
This is starting to feel like reverse prop drilling with I have to declare a fragment at the lower end of my app and pass it up the chain.
Same with allEmployees. It's the same data that I should only get once and pass down or access through context but I have to pass in all these stupid fragments or relay complains.