Skip to content

Commit 40b579f

Browse files
Xiangxin Sunfacebook-github-bot
authored andcommitted
Add onResume in cacheConfig for Relay subscriptions
Reviewed By: leon-meta Differential Revision: D69057139 fbshipit-source-id: 1c0c526942f95dca661c4d155396c4d02de83d49
1 parent d51fae0 commit 40b579f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-react-double-effects-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function expectToHaveFetched(
3737
liveConfigId?: ?string,
3838
metadata?: {[key: string]: mixed},
3939
onSubscribe?: () => void,
40+
onResume?: (pauseTimeMs: number) => void,
4041
poll?: ?number,
4142
transactionId?: ?string,
4243
},

packages/react-relay/relay-hooks/__tests__/useLazyLoadQueryNode-fast-refresh-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function expectToHaveFetched(
5454
liveConfigId?: ?string,
5555
metadata?: {[key: string]: mixed},
5656
onSubscribe?: () => void,
57+
onResume?: (pauseTimeMs: number) => void,
5758
poll?: ?number,
5859
transactionId?: ?string,
5960
},

packages/react-relay/relay-hooks/__tests__/useQueryLoader-react-double-effects-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function expectToHaveFetched(
3535
liveConfigId?: ?string,
3636
metadata?: {[key: string]: mixed},
3737
onSubscribe?: () => void,
38+
onResume?: (pauseTimeMs: number) => void,
3839
poll?: ?number,
3940
transactionId?: ?string,
4041
},

packages/relay-runtime/util/RelayRuntimeTypes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export type VariablesOf<T: OperationType> = T['variables'];
5353
* state of any configured response cache.
5454
* - `poll`: causes a query to live update by polling at the specified interval
5555
* in milliseconds. (This value will be passed to setTimeout.)
56-
* - `liveConfigId`: causes a query to live update by calling GraphQLLiveQuery,
57-
* it represents a configuration of gateway when doing live query
58-
* - `onSubscribe`: Not in use.
56+
* - `liveConfigId`: Makes a query live by sending through RTI stack.
57+
* - `onSubscribe`: Callback to be called when a live query stream is started.
58+
* - `onResume`: Callback to be called when a live query stream is resumed, e.g. from a network disconnection.
5959
* - `metadata`: user-supplied metadata.
6060
* - `transactionId`: a user-supplied value, intended for use as a unique id for
6161
* a given instance of executing an operation.
@@ -65,6 +65,7 @@ export type CacheConfig = {
6565
poll?: ?number,
6666
liveConfigId?: ?string,
6767
onSubscribe?: () => void,
68+
onResume?: (pauseTimeMs: number) => void,
6869
metadata?: {[key: string]: mixed, ...},
6970
transactionId?: ?string,
7071
};

0 commit comments

Comments
 (0)