Releases: jcoreio/apollo-magic-refetch
Releases · jcoreio/apollo-magic-refetch
v2.1.0
v2.0.1
v2.0.0
2.0.0 (2018-12-20)
Bug Fixes
- refactor so that fetching type metadata without an introspection query is possible (3e709b9)
BREAKING CHANGES
- the following old way of prefetching the metadata is no longer supported:
import getSchemaTypes from 'apollo-magic-refetch/getSchemaTypes'
import client from './wherever/you/create/your/apollo/client'
getSchemaTypes(client)
Instead, do the following:
import refetch from 'apollo-magic-refetch'
import client from './wherever/you/create/your/apollo/client'
refetch.fetchTypeMetadata(client)
Since it is common to disable introspection queries in production, I have refactored to
support fetching the type metadata by other means.
For instance, you could set up the following route on your server:
import { execute } from 'graphql'
import schema from './path/to/your/graphql/schema'
import express from 'express'
import { typesQuery } from 'apollo-magic-refetch'
const app = express()
const typeMetadataPromise = execute(schema, typesQuery)
app.get('/graphql/refetchTypeMetadata', (req, res) => {
typeMetadataPromise.then(data => res.json(data))
})
And then pass this data to refetch.setTypeMetadata
before you ever call
refetch()
:
import refetch from 'apollo-magic-refetch'
// accepts a promise that resolves to the graphql execution result.
refetch.setTypeMetadata(
fetch('/graphql/refetchTypeMetadata').then(res => res.json())
)
v1.2.0
v1.1.5
v1.1.4
v1.1.3
v1.1.2
v1.1.1
v1.1.0
1.1.0 (2018-07-18)
Features
- refetch: support an array of conditions for handling association changes (ff8be14)
See https://github.com/jcoreio/apollo-magic-refetch#handling-associations-being-broken
and https://github.com/jcoreio/apollo-magic-refetch#handling-associations-being-created for more details about this exciting new feature!