-
Notifications
You must be signed in to change notification settings - Fork 7
Update apollo client to v3 #39
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
base: master
Are you sure you want to change the base?
Changes from all commits
eba47d9
cccd732
90a058b
b1c267e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,23 +41,23 @@ | |
"threshold": "1 Kb" | ||
} | ||
], | ||
"dependencies": { | ||
"@apollo/client": "^3.5.6", | ||
"apollo-fragment-utils": "^0.2.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll need to bump the version of |
||
"compose-tiny": "^1.1.3" | ||
}, | ||
"peerDependencies": { | ||
"@apollo/client": "^3.5.6" | ||
}, | ||
"devDependencies": { | ||
"@types/graphql": "0.11.5", | ||
"@types/jest": "22.1.x", | ||
"apollo-cache-inmemory": "^1.1.5", | ||
"@apollo/client": "^3.5.6", | ||
"apollo-link": "^1.0.0", | ||
"browserify": "14.5.0", | ||
"bundlesize": "0.15.3", | ||
"codecov": "3.0.0", | ||
"bundlesize": "^0.18.1", | ||
"codecov": "^3.8.2", | ||
"danger": "1.2.0", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"graphql": "0.11.7", | ||
"graphql-tag": "2.5.0", | ||
"graphql": "16.0.1", | ||
"jest": "21.2.1", | ||
"lint-staged": "4.3.0", | ||
"pre-commit": "1.2.2", | ||
|
@@ -89,11 +89,6 @@ | |
"<rootDir>/src/mocks/enzymeAdapter.ts" | ||
] | ||
}, | ||
"dependencies": { | ||
"apollo-fragment-utils": "^0.2.1", | ||
"apollo-utilities": "^1.0.12", | ||
"compose-tiny": "^1.1.3" | ||
}, | ||
"lint-staged": { | ||
"*.ts*": [ | ||
"prettier --trailing-comma all --single-quote --write", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
import gql from 'graphql-tag'; | ||
import { DocumentNode } from 'graphql'; | ||
import { gql } from '@apollo/client/core'; | ||
import { DocumentNode, Kind } from 'graphql'; | ||
|
||
export function getFragmentInfo(fragment: string | DocumentNode) { | ||
const fragmentAST = typeof fragment === `string` ? gql(fragment) : fragment; | ||
const fragmentDefinitions = | ||
fragmentAST.definitions && fragmentAST.definitions[0]; | ||
const fragmentName = fragmentDefinitions && fragmentDefinitions.name.value; | ||
const fragmentTypeName = | ||
fragmentDefinitions && fragmentDefinitions.typeCondition.name.value; | ||
// ensure we are working with the right kind of definition, otherwise throw warning | ||
if ( | ||
fragmentAST.definitions && | ||
fragmentAST.definitions[0] && | ||
fragmentAST.definitions[0].kind === Kind.FRAGMENT_DEFINITION | ||
) { | ||
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to make some updates here for TS to compile. Would appreciate feedback on the |
||
const fragmentDefinitions = | ||
fragmentAST.definitions && fragmentAST.definitions[0]; | ||
const fragmentName = fragmentDefinitions && fragmentDefinitions.name.value; | ||
const fragmentTypeName = | ||
fragmentDefinitions && fragmentDefinitions.typeCondition.name.value; | ||
|
||
return { | ||
fragmentName, | ||
fragmentTypeName, | ||
}; | ||
return { | ||
fragmentName, | ||
fragmentTypeName, | ||
}; | ||
} else { | ||
console.warn( | ||
`Received fragment with definition kind: ${fragmentAST.definitions[0].kind} but ${Kind.FRAGMENT_DEFINITION} is required`, | ||
); | ||
} | ||
} | ||
|
||
export type buildFragmentQueryType = { | ||
|
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.
Jury is still out on what to do with these deps. Will circle back after having a conversation