From 48621b3c7e80faa70358db80902bb7d17e2ac809 Mon Sep 17 00:00:00 2001 From: David Stotijn Date: Fri, 17 Jul 2020 22:25:41 +0200 Subject: [PATCH] Update to 3.0 in api-routes-apollo-server-and-client example (#15270) --- .../api-routes-apollo-server-and-client/apollo/client.js | 7 +++---- .../apollo/type-defs.js | 2 +- .../api-routes-apollo-server-and-client/package.json | 9 +-------- .../api-routes-apollo-server-and-client/pages/_app.js | 2 +- .../api-routes-apollo-server-and-client/pages/index.js | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/examples/api-routes-apollo-server-and-client/apollo/client.js b/examples/api-routes-apollo-server-and-client/apollo/client.js index dd890d1d3ffdf..0a709fd8a716c 100644 --- a/examples/api-routes-apollo-server-and-client/apollo/client.js +++ b/examples/api-routes-apollo-server-and-client/apollo/client.js @@ -1,16 +1,15 @@ import { useMemo } from 'react' -import { ApolloClient } from 'apollo-client' -import { InMemoryCache } from 'apollo-cache-inmemory' +import { ApolloClient, InMemoryCache } from '@apollo/client' let apolloClient function createIsomorphLink() { if (typeof window === 'undefined') { - const { SchemaLink } = require('apollo-link-schema') + const { SchemaLink } = require('@apollo/client/link/schema') const { schema } = require('./schema') return new SchemaLink({ schema }) } else { - const { HttpLink } = require('apollo-link-http') + const { HttpLink } = require('@apollo/client/link/http') return new HttpLink({ uri: '/api/graphql', credentials: 'same-origin', diff --git a/examples/api-routes-apollo-server-and-client/apollo/type-defs.js b/examples/api-routes-apollo-server-and-client/apollo/type-defs.js index e6da839c1b650..53c485d64e499 100644 --- a/examples/api-routes-apollo-server-and-client/apollo/type-defs.js +++ b/examples/api-routes-apollo-server-and-client/apollo/type-defs.js @@ -1,4 +1,4 @@ -import gql from 'graphql-tag' +import { gql } from '@apollo/client' export const typeDefs = gql` type User { diff --git a/examples/api-routes-apollo-server-and-client/package.json b/examples/api-routes-apollo-server-and-client/package.json index e271c23f951d4..94c93c4b7072c 100644 --- a/examples/api-routes-apollo-server-and-client/package.json +++ b/examples/api-routes-apollo-server-and-client/package.json @@ -7,16 +7,9 @@ "start": "next start" }, "dependencies": { - "@apollo/react-common": "^3.1.4", - "@apollo/react-hooks": "^3.1.5", - "apollo-cache-inmemory": "^1.6.6", - "apollo-client": "^2.6.10", - "apollo-link-http": "^1.5.17", - "apollo-link-schema": "^1.2.5", + "@apollo/client": "^3.0.2", "apollo-server-micro": "^2.14.2", - "apollo-utilities": "^1.3.2", "graphql": "^14.0.2", - "graphql-tag": "2.10.3", "next": "latest", "prop-types": "^15.6.2", "react": "^16.7.0", diff --git a/examples/api-routes-apollo-server-and-client/pages/_app.js b/examples/api-routes-apollo-server-and-client/pages/_app.js index 0345a86b23ea3..482728ae76e6d 100644 --- a/examples/api-routes-apollo-server-and-client/pages/_app.js +++ b/examples/api-routes-apollo-server-and-client/pages/_app.js @@ -1,4 +1,4 @@ -import { ApolloProvider } from '@apollo/react-hooks' +import { ApolloProvider } from '@apollo/client' import { useApollo } from '../apollo/client' export default function App({ Component, pageProps }) { diff --git a/examples/api-routes-apollo-server-and-client/pages/index.js b/examples/api-routes-apollo-server-and-client/pages/index.js index 643c38b3dd6c1..4c40076bb98bb 100644 --- a/examples/api-routes-apollo-server-and-client/pages/index.js +++ b/examples/api-routes-apollo-server-and-client/pages/index.js @@ -1,6 +1,6 @@ import gql from 'graphql-tag' import Link from 'next/link' -import { useQuery } from '@apollo/react-hooks' +import { useQuery } from '@apollo/client' import { initializeApollo } from '../apollo/client' const ViewerQuery = gql`