Code Monkey home page Code Monkey logo

Comments (4)

nevir avatar nevir commented on June 12, 2024

Thanks for the detailed example here!

The trouble here is that hermes isn't currently aware of type unions (nor fragments with type conditions) :( So, when it sees the array there, it doesn't know to redirect fields for First typed results to FirstFields, nor Second typed to SecondFields.

It looks like the second fragment is winning (without any warning or error!), and it's interpreting the query as if it were:

{
  foo {
    __typename
    id
    bar: foo
  }
}
  • The first two results get no value for foo, because hermes is expecting a value under bar, and ignores unknown fields in the payload
  • The result for the last entry is "correct" hermes behavior for aliased fields, however, and probably unlikely to change (because hermes can return more fields than you ask for)

from apollo-cache-hermes.

nevir avatar nevir commented on June 12, 2024

Until we support union types, I'm going to see if I can at least get an error in there to detect cases where fragments/queries disagree about field aliases

from apollo-cache-hermes.

nevir avatar nevir commented on June 12, 2024

…and also warnings about type constraints not being supported.

from apollo-cache-hermes.

jamesreggio avatar jamesreggio commented on June 12, 2024

Just as a note, I added a (skipped, failing) test to the repo a while back that reflects this behavior: 01c7b34

We should re-enable it when we want to fix this.

from apollo-cache-hermes.

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.