Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native already polyfills fetch #38

Closed
msluther opened this issue Jan 29, 2019 · 1 comment
Closed

react-native already polyfills fetch #38

msluther opened this issue Jan 29, 2019 · 1 comment

Comments

@msluther
Copy link
Contributor

react-native has built-in fetch polyfills based on whatwg-fetch already (https://github.com/facebook/react-native/blob/master/Libraries/Core/setUpXHR.js#L23-L26 some variant of this has existed over the last ~4 years or so from github history).

As such there's no real need to bundle in another fetch-ponyfill for react-native consumers. cross-fetch can simply re-export the existing fetch function (and related types).

There also exists some timing issue where the browser ponyfill is stomping the global fetch function with false here. The repro I've seen is in a decent sized app, while running in an iOS simulator and react-native@57. If I run the app, then start react-native JS debugging, this causes global.fetch to get set to false and never unset.

@lquixada
Copy link
Owner

Makes a lot of sense to me! Awesome idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants