Skip to content
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

Merged
merged 4 commits into from Feb 23, 2023

Conversation

mjfwebb
Copy link
Contributor

@mjfwebb mjfwebb commented Jan 4, 2023

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

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have a helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • e2e tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have a helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running pnpm build && pnpm lint
  • The "examples guidelines" are followed from our contributing doc

@ijjk ijjk added the examples Issue/PR related to examples label Jan 4, 2023
examples/with-apollo-neo4j-graphql/package.json Outdated Show resolved Hide resolved
@@ -0,0 +1,17 @@
import { gql } from '@apollo/client'
Copy link

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.

Copy link
Contributor Author

@mjfwebb mjfwebb Jan 5, 2023

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?

Copy link

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...

This refactor moves the code from Javascript to Typescript.

This also uses Apollo server version 4 along with the @as-integrations/next
package.
@kodiakhq kodiakhq bot merged commit 4faf579 into vercel:canary Feb 23, 2023
@mjfwebb mjfwebb deleted the update-with-apollo-neo4j-graphql branch February 23, 2023 14:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants