mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Adding onReadyStateChange callback to setVariables
`this.props.relay.setVariables` takes an optional callback that's not currently represented in the types. Just adding that. See this answer on StackOverflow for a high-level overview: http://stackoverflow.com/questions/35471836/loading-indicator-after-this-props-relay-setvariables-triggered-fetch And the docs have more detailed information about what the callback provides: https://facebook.github.io/relay/docs/guides-ready-state.html
This commit is contained in:
Vendored
+25
-2
@@ -103,8 +103,31 @@ declare module "react-relay" {
|
||||
renderFailure?(error: Error, retry: Function): JSX.Element
|
||||
}
|
||||
|
||||
type ReadyStateEvent =
|
||||
'ABORT' |
|
||||
'CACHE_RESTORED_REQUIRED' |
|
||||
'CACHE_RESTORE_FAILED' |
|
||||
'CACHE_RESTORE_START' |
|
||||
'NETWORK_QUERY_ERROR' |
|
||||
'NETWORK_QUERY_RECEIVED_ALL' |
|
||||
'NETWORK_QUERY_RECEIVED_REQUIRED' |
|
||||
'NETWORK_QUERY_START' |
|
||||
'STORE_FOUND_ALL' |
|
||||
'STORE_FOUND_REQUIRED';
|
||||
|
||||
interface OnReadyStateChange {
|
||||
(readyState: {
|
||||
ready: boolean,
|
||||
done: boolean,
|
||||
stale: boolean,
|
||||
error?: Error,
|
||||
events: Array<ReadyStateEvent>,
|
||||
aborted: boolean
|
||||
}): void
|
||||
}
|
||||
|
||||
interface RelayProp {
|
||||
variables: any
|
||||
setVariables(variables: Object): void
|
||||
variables: any
|
||||
setVariables(variables: Object, onReadyStateChange?: OnReadyStateChange): void
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user