Comments (11)
Alright! @alexanderson1993, the fix for your situation is to add the following to index.js
:
import 'core-js/es6/symbol';
import 'core-js/es6/set';
import 'core-js/es6/map';
The root cause here is that RN fails to correctly polyfill Symbol
in the Android environment (the issue linked above). So, we explicitly load that polyfill, and also Set
/Map
for good measure, as Hermes also relies on those.
I'm going to see if I can have Hermes detect this case and throw a helpful error…
from apollo-cache-hermes.
Aha, nope, it's a RN packager issue: facebook/react-native#4676
from apollo-cache-hermes.
I'm sorry for the delay on this issue. Working on getting my machine set up for android again (I've gone and goofed my SDK/NDK somewhere)
In the meantime, do you have a stack trace handy—or remember what error was being thrown?
from apollo-cache-hermes.
I'm afraid I'm not technically savvy enough to be able to pull up a stack trace or even the error thrown. The app crashed immediately after the request was made, and I was only able to track down apollo-cache-hermes as the culprit after a lot of trial and error.
from apollo-cache-hermes.
Alright, I'm able to reproduce this one! Not sure exactly what's going on, yet. Here's what I know so far:
- The app is running out of memory and being killed by the OS
- It occurs before apollo client even initiates the network request (the configured apollo link is not called)
- None of Hermes' verbose logging triggers before the OOM occurs
from apollo-cache-hermes.
Actually, interestingly, the OOM occurs sometime before Hermes' query interface is called.
I have a hunch that it's similar to zloirock/core-js#368, but can't prove that yet
from apollo-cache-hermes.
Aha! Nope, it is getting into Hermes' read call, somewhat. I've narrowed it down to this loop:
It iterates forever for your query (when consuming an empty set), emitting undefined until OOM. Might be a tslib bug, or we might be passing unexpected data to it
from apollo-cache-hermes.
Oof, it may be a tslib bug. Just filed microsoft/tslib#59 to get some more eyes on it. Might also be that react-native android is incorrectly polyfilling Set/Map...
from apollo-cache-hermes.
This is fabulous! Many thanks!
from apollo-cache-hermes.
Hopefully this error helps people from having to go down this rabbit hole again:
from apollo-cache-hermes.
Alright! @alexanderson1993, the fix for your situation is to add the following to
index.js
:import 'core-js/es6/symbol'; import 'core-js/es6/set'; import 'core-js/es6/map';The root cause here is that RN fails to correctly polyfill
Symbol
in the Android environment (the issue linked above). So, we explicitly load that polyfill, and alsoSet
/Map
for good measure, as Hermes also relies on those.I'm going to see if I can have Hermes detect this case and throw a helpful error…
Thanks @nevir it worked like a charm
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
- Cache returns incorrect data when using aliases on different fields with the same name HOT 4
- Verify that migrated reference field correctly garbage collects `outbound` and `inbound` references
- 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.