Repository navigation
Meta: Use variables in GraphQL - #6674
Conversation
|
JMHO, on any non simple query I think this lowers readability |
|
It’s definitely more verbose but there’s no alternative if we want to extract the queries: Once extracted we’ll have syntax highlighting and potentially some validation, as well as proper types for v4 calls. I think it’s worth it, even if the query ends up being in a different file. |
fregante
left a comment
There was a problem hiding this comment.
Everything here was tested. Some features were even restored, some tickets were created.
In a future PR:
- Extract to .gql files
- Update every query (I ignored the simple ones without additional variables, although they're still affected by this change)
There was a problem hiding this comment.
You can see what the usage of .gql files will look like in list-prs-for-file
Missing:
- TypeScript integration that will help us use the results in the file
- GraphQL autocomplete in the IDE thanks to the schema
- Typed
variablesthat make TypeScript complain if one is missing or unused - Prettier/formatter for GQL support (we have a .prettierignore file)
| field: UPDATED_AT, | ||
| direction: DESC | ||
| } | ||
| ) { |
There was a problem hiding this comment.
Demo extracted GQL file
| } | ||
| `); | ||
| debugger; | ||
| const {repository} = await api.v4(listPrsForFileQuery, { |
There was a problem hiding this comment.
Demo feature with extracted query
There was a problem hiding this comment.
Nice!
Can we put this in a new pr?
This PR
This is harder than anticipated:
Test
Extensions suggested: