Skip to content

Allow @stream on scalar lists#5321

Open
AlicanC wants to merge 2 commits into
facebook:mainfrom
AlicanC:jc/scalar-streaming
Open

Allow @stream on scalar lists#5321
AlicanC wants to merge 2 commits into
facebook:mainfrom
AlicanC:jc/scalar-streaming

Conversation

@AlicanC

@AlicanC AlicanC commented Jun 15, 2026

Copy link
Copy Markdown

The @stream directive is currently only supported on lists of objects, but it should also be supported on lists of scalars.

Currently when @stream is used on a list of scalars, relay-compiler throws a InvalidStreamOnScalarField error.

So with a schema like this:

type Query {
  stringChunks: [String!]!
}

You can't do this:

query MyQuery {
  stringChunks @stream(initialCount: 1) # this could work but currently throws an error
}

So you have to modify your schema like this:

type WrappedString {
  value: String!
}

type Query {
  stringChunks: [WrappedString!]!
}

And do this:

query MyQuery {
  stringChunks @stream(initialCount: 1) {
    value
  }
}

This PR makes the necessary changes so @stream can be used on scalar lists.

Fixes #3755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[relay-compiler 13] Invalid use of @stream on scalar field

2 participants