Comments (4)
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 underbar
, 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.
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.
…and also warnings about type constraints not being supported.
from apollo-cache-hermes.
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)
- An in-range update of apollo-cache is breaking the build 🚨 HOT 4
- Switch from chai to jasmine expectations
- Stale data passed to Query prop after writeFragment operation HOT 1
- Verify that migrated reference field correctly garbage collects `outbound` and `inbound` references
- Continuous crashes on React Native Android HOT 11
- Add better description of what a normalized graph cache is HOT 1
- Concurrent access from multiple instances HOT 1
- Cannot execute consecutive queries that would return the same data HOT 4
- Does not work with create-react-app with Typescript
- writeFragment blows away entity's __typename HOT 10
- RangeError: Maximum call stack size exceeded with a slightly complex query
- Adding more descriptive logging for InvalidPayloadError HOT 3
- Implement or document dataIdFromObject HOT 4
- Support freezeResults? HOT 2
- Much bigger than apollo-cache-inmemory HOT 1
- missing peer dependency on graphql
- bug: `GraphSnapshot` is not exported (but should be)
- 'useQuery' never returns data for entries written to the cache with 'writeFragment'
- Sync cache across tabs? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-cache-hermes.