-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
network activity callbacks from DefaultNetworkLayer #1120
Comments
In general we'd prefer to keep the default network layer as simple as possible. To add custom functionality such as network activity callbacks, you can compose the default implementation in your own object/class with whatever hooks you need. Does this work for your use case? |
Makes sense. I'll give composing the default implementation a try. Thanks. |
@ben you might be interested in this recent effort On Thu, May 5, 2016 at 6:15 PM Ben McMahen notifications@github.com wrote:
|
For what it's worth, composing the default implementation was super easy and proved perfect for the task. |
Cool! Big props to @nodkz for taking this on. |
I'm developing a react-native app using relay and would find network activity callbacks useful from the
DefaultNetworkLayer
. It would allow me to centralize management of theStatusBarIOS
network activity indicator if I could tell when a) an active request has started, and b) the request has ended (either successfully, or with an error).I think I could do a PR for this relatively easily, if there's interest. The alternatives to this approach would be to use the readyState in
Relay.Renderer
or to build my own custom network layer. The problem with the first approach is that, especially in mobile apps, you end up withRelay.Renderer
calls throughout the app, and sometimes the readyState doesn't indicate whether the data is being fetched from the cache, or over the network layer.The text was updated successfully, but these errors were encountered: