Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid using prototype objects as keys in QueryKeyMaker Maps.
Fixes apollographql/react-apollo#2442. This temporarily mitigates the prototype chain bug that will be permanently fixed by this React Native PR that I submitted yesterday: facebook/react-native#21492 I would like to find a way to bundle a different Map polyfill in React Native apps, without increasing bundle sizes for non-RN apps, but that has proven tricky so far. For future reference, this seems to be the way to do it (thanks to @peggyrayzis for the tip): https://facebook.github.io/react-native/docs/platform-specific-code#platform-specific-extensions Until a new version of React Native is released with these changes included, the simplest way to fix the problem is simply to avoid storing any prototype objects in a Map, so that's what I've done in this commit. We are already wrapping Object.freeze and friends in src/fixPolyfills.ts, which should make it possible to use frozen objects as Map keys (the other bug that I addressed in the React Native PR linked above).
- Loading branch information