-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Network.executeWithEvents for surfacing (lifecycle) events
Summary: We want to be able to surface lifecycle events to Relay subscriptions, through the `onNext` callback. In order to do this, we must implement another function, `Network.executeWithEvents`, if we want to avoid passing events through the observable returned by `Network.execute`. Summary of changes: - `StreamPayload` is a union of `ExecutePayload` and `EventPayload`. - The `Network` object is returned by `RelayNetwork.create`, so this function has been modified so that its returned object also contains a `Network.executeWithEvents` function. - `RelayModernEnvironment` also has an `executeWithEvents`, which calls `Network.executeWithEvents`. Its `do` simply ignores events via early return. `RelayStoreTypes` has been updated to include `executeWithEvents` in `Environment`'s interface. - The `SubscribeFunction` type in `RelayNetworkTypes` now has a return type of `Observable<StreamPayload>`. In `ConvertToExecuteFunction`, there is now a `convertSubcribeWithEvents` function that takes a `SubscribeFunction` and returns a `StreamFunction`. The `convertSubcribe` function still returns an `ExecuteFunction`, though there is extra filter logic to filter out events. - Within `requestRelaySubscription`, `GraphQLSubscriptionConfig` now includes an optional `receiveEvents` field. If present, it calls `executeWithEvents`. Otherwise it defaults to `execute`, which returns an Observable with no events. Reviewed By: kassens Differential Revision: D9209901 fbshipit-source-id: 12aaf37066c4f044d881c477916cd73e9b19be4c
- Loading branch information
1 parent
8079bd7
commit 8547db2
Showing
9 changed files
with
270 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.