Giter Club home page Giter Club logo

Comments (4)

amannn avatar amannn commented on June 26, 2024 4

Oh right, thank you so much!

I can confirm that this fixes my reproduction:

  new InMemoryCache({
    typePolicies: {
      Page: {
        keyFields: false,
        merge: true,
      },
    },
    possibleTypes: {
      Page: ["^.*Page$"],
    },
  }),

Working example with Page interface.

from apollo-client.

amannn avatar amannn commented on June 26, 2024

Oh, I just noticed #6901 mentions possibleTypes while my reproduction uses typePolicies. I came here after this tweet by @phryneas. Can type policies also be fuzzy?

from apollo-client.

bignimbus avatar bignimbus commented on June 26, 2024

Hi @amannn 👋🏻 thanks for opening this issue! This area of the library is not something the current team has dealt with a lot so give us some time to get some recommendations together for you. @benjamn did recently write this very helpful spec though, which might help move things forward for you:

it("typePolicies can be inherited from supertypes with fuzzy possibleTypes", () => {
const cache = new InMemoryCache({
possibleTypes: {
EntitySupertype: [".*Entity"],
},
typePolicies: {
Query: {
fields: {
coworkers: {
merge(existing, incoming) {
return existing ? existing.concat(incoming) : incoming;
},
},
},
},
// The point of this test is to ensure keyFields: ["uid"] can be
// registered for all __typename strings matching the RegExp /.*Entity/,
// without manually enumerating all of them.
EntitySupertype: {
keyFields: ["uid"],
},
},
});

from apollo-client.

github-actions avatar github-actions commented on June 26, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

from apollo-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.