relay-tools / vscode-apollo-relay

Simple configuration of vscode-apollo for Relay projects.
MIT License
49 stars 13 forks source link

Relay 13 support #36

Open petrbela opened 2 years ago

petrbela commented 2 years ago

Seems Relay 13 no longer uses relay-config. What is the configuration we should pass to apollo.client.js? If I follow the expanded example in readme, it throws Unable to load relay-compiler, so 'includes' may need manual configuration. when calling generateConfig, followed by Cannot read property 'schemaExtensions' of undefined.

FWIW, I can set up the Apollo VSCode plugin and get field autocompletion without this plugin and setting apollo.config.js to the following (but not sure what features from this plugin I'm missing and will need later?):

module.exports = {
  client: {
    tagName: 'graphql',
    service: {
      name: '...',
      localSchemaFile: './schema.graphql',
    },
  },
}
FINDarkside commented 2 years ago

Relay specific stuff doesn't seem to work at least. with that setup. Unknown directive "@refetchable".GraphQL: Validation

micheleb commented 2 years ago

you can actually add support for Relay-specific directives using external definitions, using e.g. this project.

I actually included a local definition file with what I need instead, by adding it to the schema list in my .graphqlrc.yml conf file:

schema: 
  - "./data/schema.graphql"
  - "./data/relay-directives.graphql"
documents: "./src/**/*.{ts,tsx}"
relay-directives.graphql ``` directive @connection( key: String! filters: [String] handler: String dynamicKey_UNSTABLE: String ) on FIELD directive @refetchable(queryName: String!) on FRAGMENT_DEFINITION directive @arguments on FRAGMENT_SPREAD input First { type: String! defaultValue: Int! } input After { type: String! } directive @argumentDefinitions( first: First after: After ) on FRAGMENT_DEFINITION directive @raw_response_type on QUERY | MUTATION | SUBSCRIPTION directive @relay(plural: Boolean!) on FRAGMENT_DEFINITION ```
petrbela commented 2 years ago

FYI, there's an official Relay VSCode extension in the works to be available as soon as the next Relay version is released.