-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
help wantedmetaRelated to Refined GitHub itselfRelated to Refined GitHub itselfsmallIssues that new contributors can pick upIssues that new contributors can pick up
Description
GraphQL offers its own variables system. I always avoided it because it was verbose (π€¦ββοΈ) but it would actually offer a good solution to improper memoization:
Use variables
Before:
api.v4(`
repository () {
name
}
`)Probably after:
api.v4(`
repository (owner: $owner, name: $name) {
name
}
`, {variables: getRepo()!})Extract queries to .gql
Separately, I wonder if we could extract these queries to proper GQL files and then import them using a webpack loader.
The best advantage to this would be if there was a typescript transformer that actually parsed these files and provided types.
Webpack would only need to import them as raw text while TypeScript would receive proper types from these files so that we don't need to deal with any π
Formatting and validation would also be nice side effects of this.
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedmetaRelated to Refined GitHub itselfRelated to Refined GitHub itselfsmallIssues that new contributors can pick upIssues that new contributors can pick up