Skip to content

Instantly share code, notes, and snippets.

View markkanof's full-sized avatar

Mark Kanof markkanof

View GitHub Profile
@tlux
tlux / custom-apollo-client.js
Last active December 2, 2017 15:06
GraphQL: Using fragments on interfaces or unions with Absinthe and Apollo. The Mix task basically generates a JSON file from your Absinthe schema that contains mappings of interfaces/unions to the particular implemented types. This file can subsequently be read by your custom Apollo client.
// Provides an automated solution for the following issue:
// http://dev.apollodata.com/react/initialization.html#fragment-matcher
import {
ApolloClient,
createNetworkInterface,
IntrospectionFragmentMatcher
} from 'apollo-client'
import types from './typemap.json'