This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Query { | |
hiringManager(jobId: ID!): User | |
jobPost(jobId: ID!): Job | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
date: '2018-06-29', | |
dateTime: '14:30:00.000Z' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
Query: { | |
someDateTimeResolver: () => { | |
return { | |
date: new Date(), | |
dateTime: new Date(new Date() - 234798274), | |
}; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { withApolloFragment } from "apollo-fragment-react"; | |
import { compose, renameProp } from 'recompose'; | |
const permissionsFragment = ` | |
fragment permissionsFields on User { | |
permissions { | |
role | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { ApolloFragment } from "apollo-fragment-react"; | |
const permissionsFragment = ` | |
fragment permissionsFields on User { | |
permissions { | |
role | |
} | |
} | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function fragmentLinkState(apolloCache: ApolloCache<any>): ApolloLink { | |
return withClientState({ | |
cache: apolloCache, | |
resolvers: { | |
Query: { | |
getFragment: ( | |
_: any, | |
{ __typename, id }: GetFragmentType, | |
{ cache }: { cache: any }, | |
) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloClient } from "apollo-client"; | |
import { ApolloLink } from "apollo-link"; | |
import { InMemoryCache } from "apollo-cache-inmemory"; | |
import { | |
fragmentCacheRedirect, | |
fragmentLinkState | |
} from "apollo-link-state-fragment"; | |
const cache = new InMemoryCache({ | |
cacheRedirects: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { InMemoryCache } from "apollo-cache-inmemory"; | |
import { fragmentCacheRedirect } from "apollo-link-state-fragment"; | |
const cache = new InMemoryCache({ | |
cacheRedirects: { | |
Query: { | |
...fragmentCacheRedirect() | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default createFragmentContainer(ComponentThatIsDeepInTheTree, { | |
currentUser: graphql` | |
fragment ComponentThatIsDeepInTheTree_currentUser on User { | |
permissions { | |
role | |
} | |
} | |
` | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gql from 'graphql-tag'; | |
const currentUserQuery = gql` | |
fragment permissionFields on User { | |
permissions { | |
role | |
} | |
} | |
query currentUser { |