Skip to content

Releases: jcoreio/apollo-magic-refetch

v2.1.0

04 Mar 23:10
Compare
Choose a tag to compare

2.1.0 (2024-03-04)

Features

  • add TS type definitions (8b426b3)

v2.0.1

28 Jan 21:17
Compare
Choose a tag to compare

2.0.1 (2022-01-28)

Bug Fixes

  • get rid of module field in package.json (987d58b)
  • ignore cache-only queries, which don't support refetch (915378e)

v2.0.0

20 Dec 21:28
Compare
Choose a tag to compare

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

20 Dec 20:26
Compare
Choose a tag to compare

1.2.0 (2018-12-20)

Features

  • export typesQuery used to fetchh type metadata (daa1408)
  • support predicates on values, in addition to just target ids (57aadba)

v1.1.5

20 Dec 20:01
Compare
Choose a tag to compare

1.1.5 (2018-12-20)

Bug Fixes

  • doesQueryContain: support recursive types (b152e10), closes #2

v1.1.4

20 Dec 19:11
Compare
Choose a tag to compare

1.1.4 (2018-12-20)

Bug Fixes

v1.1.3

07 Aug 22:13
Compare
Choose a tag to compare

1.1.3 (2018-08-07)

Bug Fixes

  • check client type at runtime instead of in flow (0373c41)

v1.1.2

07 Aug 16:54
Compare
Choose a tag to compare

1.1.2 (2018-08-07)

Bug Fixes

v1.1.1

19 Jul 01:58
Compare
Choose a tag to compare

1.1.1 (2018-07-19)

Bug Fixes

  • doesQueryContain: improve error message if type not found (97b4819)

v1.1.0

18 Jul 22:07
Compare
Choose a tag to compare

1.1.0 (2018-07-18)

Features