n1ru4l/graphql-live-query

if argument on live directive

n1ru4l opened this issue · 0 comments

It would be nice if you could define whether a query should be live or not via a Boolean query argument. The main benefit I see is that the operation could then be used for SSR and streaming the results afterward.

unless could also be a valid option.

query users($isClient: Boolean = false) @live(if: $isClient) {
  users(first: 10) {
    id
    login
  }
}
const Foo = () => {
  const isSSR = useIsSSR();
  const [data] = useQuery(UsersQuery, { isClient: !isSSR })
  ...
}