-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EXAMPLES] Update with-apollo-neo4j-graphql #44570
[EXAMPLES] Update with-apollo-neo4j-graphql #44570
Conversation
@@ -0,0 +1,17 @@ | |||
import { gql } from '@apollo/client' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand properly that this is a file used only on the server? Then I don't think we need this dependency on @apollo/client
. I'd import gql from 'graphql-tag'
directly instead (this is just a re-export), or honestly just define the schema as a string (perhaps read with fs.readFileSync from a schema.graphql
file for better editor support) rather than parsing it with the gql tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glasser It is also imported indirectly, via the schema, by the Apollo client code in much the same way the existing Apollo examples do it.
Here's api-routes-apollo-server-and-client
for example:
import { schema } from '../apollo/schema' | |
import merge from 'deepmerge' | |
let apolloClient | |
function createIsomorphLink() { | |
if (typeof window === 'undefined') { | |
return new SchemaLink({ schema }) |
I'm not 100% confident we need to cover the windowless case here actually, so we could potentially update the client.
As an aside, do you know if the client file needs the .tsx
extension, or does .ts
suffice in this case with the only React code being useMemo
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you can use graphql-tag
directly in either case (and again, perhaps just a string?). But no huge deal I guess.
I'm not a client expert but I assume you only need .tsx
if you're using JSX <>
tags...
80130fe
to
b0624ea
Compare
This refactor moves the code from Javascript to Typescript. This also uses Apollo server version 4 along with the @as-integrations/next package.
b0624ea
to
6fb152f
Compare
We replace neo4j-graphql-js with @neo4j/graphql and update Apollo server to version 4.
This refactor also changes the code from Javascript to Typescript.
Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
pnpm build && pnpm lint