You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we're assuming (really, bs-fetch is assuming) that the fetch global exists. This is true for browsers, but for other environments like Node or React Native, this requires a polyfill like isomorphic-fetch or cross-fetch. Importing one of those libraries purely for the side-effect of attaching junk to the global object is really gross (and worse, it's easy to forget to do, which could cause things to break at runtime).
I'm definitely open to ideas, but it seems like the safest thing to do would be to expect ReludeFetch to be constructed with a Fetch object (module?) that provides the actual fetch implementation. In a more perfect world, maybe we'd have a trifunctor IO like ZIO where the Fetch interface could just be part of the environment.
The text was updated successfully, but these errors were encountered:
I'm totally fine with whatever you want to do here. I agree that bs-fetch and hence relude-fetch were kind of built with the assumption that fetch just exists in the global env, which is not great, but might also be something to just embrace, and require people to polyfill it however they want to, just like any other JS global inconsistency.
It would be cool to have a non-global/polyfill-based layer of indirection though - that would make testing things easier.
Currently, we're assuming (really,
bs-fetch
is assuming) that thefetch
global exists. This is true for browsers, but for other environments like Node or React Native, this requires a polyfill likeisomorphic-fetch
orcross-fetch
. Importing one of those libraries purely for the side-effect of attaching junk to the global object is really gross (and worse, it's easy to forget to do, which could cause things to break at runtime).I'm definitely open to ideas, but it seems like the safest thing to do would be to expect ReludeFetch to be constructed with a
Fetch
object (module?) that provides the actual fetch implementation. In a more perfect world, maybe we'd have a trifunctor IO like ZIO where the Fetch interface could just be part of the environment.The text was updated successfully, but these errors were encountered: