nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
929 stars 194 forks source link

fix: support function expressions in config #537

Closed miii closed 7 months ago

miii commented 10 months ago

This PR adds support for use of function expressions inside Apollo config, e.g. to define custom type policies. https://www.apollographql.com/docs/react/caching/cache-field-behavior

The current serializer, JSON.stringify, simply removes all function expressions as it cannot serialize them. This is also mentioned in https://github.com/nuxt-modules/apollo/issues/443.

A common use case for this is offset-limit paginated queries where new entries may be merged with previously fetched results (instead of treating them as different queries). https://www.apollographql.com/docs/react/pagination/offset-based#the-offsetlimitpagination-helper

netlify[bot] commented 10 months ago

Deploy Preview for apollo-module canceled.

Name Link
Latest commit 860d6ff64d21880359f37a847a5bf94b4212191d
Latest deploy log https://app.netlify.com/sites/apollo-module/deploys/64d5041b11074200087a150b