-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I'm fairly certain this is not currently possible, and I'm not even sure it is desirable. That said, is there some way to specify an argument variable based on previously fetched data?
For example, lets assume we have a contentItem type. That contentItem has two fields, isLive
and liveData
. liveData
includes a bunch of information about who set the contentItem to be live and when. We want that information, but only if the contentItem is actually live.
query content {
contentItem {
isLive
liveData @include(if: $isLive) {
liveTime
user {
username
}
}
}
}
If it is not possible, is this a feature worth considering? I see three big downsides. First, it adds some complexity to the resolution of fields. Second, we lose some parallel execution in the query, though not all. Third, there are many use cases for such a variable that are really bad design.
I am going to admit that the original reason I wrote this issue was one of those mildly bad design decisions. Fortunately, I realized it was really bad design as I start writing it down. However, the isLive/liveData
example stuck with me as useful. Granted, right now it would just return undefined
or null
, which is probably just as good. Still, something to think about.