react-relay 14.0.0 → 14.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ReactRelayContainerUtils.js.flow +0 -2
- package/ReactRelayContext.js +1 -1
- package/ReactRelayContext.js.flow +0 -2
- package/ReactRelayFragmentContainer.js.flow +0 -2
- package/ReactRelayFragmentMockRenderer.js.flow +0 -2
- package/ReactRelayLocalQueryRenderer.js.flow +0 -2
- package/ReactRelayPaginationContainer.js.flow +0 -2
- package/ReactRelayQueryFetcher.js.flow +9 -11
- package/ReactRelayQueryRenderer.js.flow +10 -12
- package/ReactRelayQueryRendererContext.js.flow +1 -3
- package/ReactRelayRefetchContainer.js.flow +0 -4
- package/ReactRelayTestMocker.js.flow +0 -2
- package/ReactRelayTypes.js.flow +6 -8
- package/RelayContext.js.flow +0 -2
- package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -4
- package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +3 -5
- package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +3 -5
- package/__flowtests__/RelayModern-flowtest.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +2 -4
- package/assertFragmentMap.js.flow +0 -2
- package/buildReactRelayContainer.js.flow +0 -2
- package/getRootVariablesForFragments.js.flow +0 -2
- package/hooks.js +1 -1
- package/hooks.js.flow +0 -2
- package/index.js +1 -1
- package/index.js.flow +2 -2
- package/isRelayEnvironment.js.flow +0 -2
- package/legacy.js +1 -1
- package/legacy.js.flow +0 -2
- package/lib/ReactRelayContainerUtils.js +0 -1
- package/lib/ReactRelayContext.js +0 -1
- package/lib/ReactRelayFragmentContainer.js +10 -9
- package/lib/ReactRelayFragmentMockRenderer.js +0 -1
- package/lib/ReactRelayLocalQueryRenderer.js +0 -1
- package/lib/ReactRelayPaginationContainer.js +14 -11
- package/lib/ReactRelayQueryFetcher.js +1 -2
- package/lib/ReactRelayQueryRenderer.js +1 -2
- package/lib/ReactRelayQueryRendererContext.js +0 -1
- package/lib/ReactRelayRefetchContainer.js +11 -14
- package/lib/ReactRelayTestMocker.js +1 -2
- package/lib/ReactRelayTypes.js +0 -1
- package/lib/RelayContext.js +0 -1
- package/lib/assertFragmentMap.js +0 -1
- package/lib/buildReactRelayContainer.js +1 -2
- package/lib/getRootVariablesForFragments.js +1 -2
- package/lib/hooks.js +0 -1
- package/lib/index.js +3 -1
- package/lib/isRelayEnvironment.js +0 -1
- package/lib/legacy.js +0 -1
- package/lib/multi-actor/useRelayActorEnvironment.js +0 -1
- package/lib/readContext.js +0 -1
- package/lib/relay-hooks/EntryPointContainer.react.js +0 -1
- package/lib/relay-hooks/EntryPointTypes.flow.js +0 -1
- package/lib/relay-hooks/FragmentResource.js +7 -7
- package/lib/relay-hooks/HooksImplementation.js +1 -1
- package/lib/relay-hooks/InternalLogger.js +0 -1
- package/lib/relay-hooks/LRUCache.js +0 -1
- package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +0 -1
- package/lib/relay-hooks/MatchContainer.js +1 -2
- package/lib/relay-hooks/ProfilerContext.js +0 -1
- package/lib/relay-hooks/QueryResource.js +1 -2
- package/lib/relay-hooks/RelayEnvironmentProvider.js +0 -1
- package/lib/relay-hooks/SuspenseResource.js +1 -2
- package/lib/relay-hooks/loadQuery.js +1 -1
- package/lib/relay-hooks/preloadQuery_DEPRECATED.js +1 -2
- package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +0 -1
- package/lib/relay-hooks/react-cache/RelayReactCache.js +0 -1
- package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +3 -3
- package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +239 -0
- package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +183 -125
- package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +0 -1
- package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +0 -1
- package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +150 -0
- package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +0 -1
- package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +367 -0
- package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +45 -0
- package/lib/relay-hooks/useBlockingPaginationFragment.js +4 -3
- package/lib/relay-hooks/useClientQuery.js +33 -0
- package/lib/relay-hooks/useEntryPointLoader.js +1 -2
- package/lib/relay-hooks/useFetchTrackingRef.js +0 -1
- package/lib/relay-hooks/useFragment.js +0 -1
- package/lib/relay-hooks/useFragmentNode.js +0 -1
- package/lib/relay-hooks/useIsMountedRef.js +0 -1
- package/lib/relay-hooks/useLazyLoadQuery.js +1 -15
- package/lib/relay-hooks/useLazyLoadQueryNode.js +0 -1
- package/lib/relay-hooks/useLoadMoreFunction.js +1 -2
- package/lib/relay-hooks/useMemoOperationDescriptor.js +0 -1
- package/lib/relay-hooks/useMemoVariables.js +0 -1
- package/lib/relay-hooks/useMutation.js +1 -2
- package/lib/relay-hooks/usePaginationFragment.js +15 -3
- package/lib/relay-hooks/usePreloadedQuery.js +1 -15
- package/lib/relay-hooks/useQueryLoader.js +1 -2
- package/lib/relay-hooks/useRefetchableFragment.js +14 -2
- package/lib/relay-hooks/useRefetchableFragmentNode.js +1 -2
- package/lib/relay-hooks/useRelayEnvironment.js +0 -1
- package/lib/relay-hooks/useStaticFragmentNodeWarning.js +0 -1
- package/lib/relay-hooks/useSubscribeToInvalidationState.js +0 -1
- package/lib/relay-hooks/useSubscription.js +0 -1
- package/multi-actor/useRelayActorEnvironment.js.flow +0 -2
- package/package.json +2 -2
- package/react-relay-hooks.js +2 -2
- package/react-relay-hooks.min.js +2 -2
- package/react-relay-legacy.js +2 -2
- package/react-relay-legacy.min.js +2 -2
- package/react-relay.js +2 -2
- package/react-relay.min.js +2 -2
- package/readContext.js.flow +0 -2
- package/relay-hooks/EntryPointContainer.react.js.flow +2 -4
- package/relay-hooks/EntryPointTypes.flow.js.flow +30 -32
- package/relay-hooks/FragmentResource.js.flow +9 -11
- package/relay-hooks/HooksImplementation.js.flow +6 -8
- package/relay-hooks/InternalLogger.js.flow +0 -2
- package/relay-hooks/LRUCache.js.flow +0 -2
- package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +4 -6
- package/relay-hooks/MatchContainer.js.flow +5 -7
- package/relay-hooks/ProfilerContext.js.flow +0 -2
- package/relay-hooks/QueryResource.js.flow +4 -6
- package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -4
- package/relay-hooks/SuspenseResource.js.flow +0 -2
- package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -3
- package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +2 -2
- package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +4 -6
- package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +0 -2
- package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +4 -6
- package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +0 -2
- package/relay-hooks/__flowtests__/utils.js.flow +8 -10
- package/relay-hooks/preloadQuery_DEPRECATED.js.flow +4 -6
- package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +0 -2
- package/relay-hooks/react-cache/RelayReactCache.js.flow +0 -2
- package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +22 -16
- package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +297 -0
- package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +134 -94
- package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +0 -2
- package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +2 -4
- package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +171 -0
- package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +2 -4
- package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +595 -0
- package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +65 -0
- package/relay-hooks/useBlockingPaginationFragment.js.flow +4 -6
- package/relay-hooks/useClientQuery.js.flow +39 -0
- package/relay-hooks/useEntryPointLoader.js.flow +6 -8
- package/relay-hooks/useFetchTrackingRef.js.flow +2 -4
- package/relay-hooks/useFragment.js.flow +0 -2
- package/relay-hooks/useFragmentNode.js.flow +2 -4
- package/relay-hooks/useIsMountedRef.js.flow +1 -3
- package/relay-hooks/useLazyLoadQuery.js.flow +7 -30
- package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -4
- package/relay-hooks/useLoadMoreFunction.js.flow +6 -8
- package/relay-hooks/useMemoOperationDescriptor.js.flow +0 -2
- package/relay-hooks/useMemoVariables.js.flow +0 -2
- package/relay-hooks/useMutation.js.flow +2 -4
- package/relay-hooks/usePaginationFragment.js.flow +44 -19
- package/relay-hooks/usePreloadedQuery.js.flow +5 -24
- package/relay-hooks/useQueryLoader.js.flow +4 -6
- package/relay-hooks/useRefetchableFragment.js.flow +32 -3
- package/relay-hooks/useRefetchableFragmentNode.js.flow +16 -18
- package/relay-hooks/useRelayEnvironment.js.flow +0 -2
- package/relay-hooks/useStaticFragmentNodeWarning.js.flow +0 -2
- package/relay-hooks/useSubscribeToInvalidationState.js.flow +0 -2
- package/relay-hooks/useSubscription.js.flow +0 -2
package/ReactRelayContext.js
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {
|
@@ -35,26 +33,26 @@ type OnDataChange = ({
|
|
35
33
|
}) => void;
|
36
34
|
|
37
35
|
/** The external API of 'fetch' **/
|
38
|
-
export type FetchOptions = {
|
36
|
+
export type FetchOptions = {
|
39
37
|
environment: IEnvironment,
|
40
38
|
onDataChange?: null | OnDataChange,
|
41
39
|
operation: OperationDescriptor,
|
42
|
-
|
40
|
+
};
|
43
41
|
|
44
42
|
// Internally we keep an array of onDataChange callbacks, to support reusing
|
45
43
|
// the queryRenderer for multiple components.
|
46
|
-
type FetchOptionsInternal = {
|
44
|
+
type FetchOptionsInternal = {
|
47
45
|
environment: IEnvironment,
|
48
46
|
onDataChangeCallbacks: Array<OnDataChange>,
|
49
47
|
operation: OperationDescriptor,
|
50
|
-
|
48
|
+
};
|
51
49
|
|
52
|
-
export type ExecuteConfig = {
|
50
|
+
export type ExecuteConfig = {
|
53
51
|
environment: IEnvironment,
|
54
52
|
operation: OperationDescriptor,
|
55
53
|
// Allows pagination container to retain results from previous queries
|
56
54
|
preservePreviousReferences?: boolean,
|
57
|
-
|
55
|
+
};
|
58
56
|
|
59
57
|
class ReactRelayQueryFetcher {
|
60
58
|
_fetchOptions: ?FetchOptionsInternal;
|
@@ -77,10 +75,10 @@ class ReactRelayQueryFetcher {
|
|
77
75
|
}
|
78
76
|
}
|
79
77
|
|
80
|
-
getSelectionReferences(): {
|
78
|
+
getSelectionReferences(): {
|
81
79
|
cacheSelectionReference: ?Disposable,
|
82
80
|
selectionReferences: Array<Disposable>,
|
83
|
-
|
81
|
+
} {
|
84
82
|
return {
|
85
83
|
cacheSelectionReference: this._cacheSelectionReference,
|
86
84
|
selectionReferences: this._selectionReferences,
|
@@ -321,7 +319,7 @@ class ReactRelayQueryFetcher {
|
|
321
319
|
}: {
|
322
320
|
notifyFirstResult: boolean,
|
323
321
|
...
|
324
|
-
}) {
|
322
|
+
}): void {
|
325
323
|
invariant(
|
326
324
|
this._fetchOptions,
|
327
325
|
'ReactRelayQueryFetcher: `_onQueryDataAvailable` should have been called after having called `fetch`',
|
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {ReactRelayQueryRendererContext as ReactRelayQueryRendererContextType} from './ReactRelayQueryRendererContext';
|
@@ -34,7 +32,7 @@ const {
|
|
34
32
|
getRequest,
|
35
33
|
} = require('relay-runtime');
|
36
34
|
|
37
|
-
type RetryCallbacks = {
|
35
|
+
type RetryCallbacks = {
|
38
36
|
handleDataChange:
|
39
37
|
| null
|
40
38
|
| (({
|
@@ -43,39 +41,39 @@ type RetryCallbacks = {|
|
|
43
41
|
...
|
44
42
|
}) => void),
|
45
43
|
handleRetryAfterError: null | ((error: Error) => void),
|
46
|
-
|
44
|
+
};
|
47
45
|
|
48
|
-
export type RenderProps<T> = {
|
46
|
+
export type RenderProps<T> = {
|
49
47
|
error: ?Error,
|
50
48
|
props: ?T,
|
51
49
|
retry: ?(cacheConfigOverride?: CacheConfig) => void,
|
52
|
-
|
50
|
+
};
|
53
51
|
/**
|
54
52
|
* React may double-fire the constructor, and we call 'fetch' in the
|
55
53
|
* constructor. If a request is already in flight from a previous call to the
|
56
54
|
* constructor, just reuse the query fetcher and wait for the response.
|
57
55
|
*/
|
58
56
|
const requestCache: {
|
59
|
-
[string]: void | {
|
57
|
+
[string]: void | {
|
60
58
|
queryFetcher: ReactRelayQueryFetcher,
|
61
59
|
snapshot: ?Snapshot,
|
62
|
-
|
60
|
+
},
|
63
61
|
} = {};
|
64
62
|
|
65
63
|
const queryRendererContext: ReactRelayQueryRendererContextType = {
|
66
64
|
rootIsQueryRenderer: true,
|
67
65
|
};
|
68
66
|
|
69
|
-
export type Props = {
|
67
|
+
export type Props = {
|
70
68
|
cacheConfig?: ?CacheConfig,
|
71
69
|
fetchPolicy?: 'store-and-network' | 'network-only',
|
72
70
|
environment: IEnvironment,
|
73
71
|
query: ?GraphQLTaggedNode,
|
74
72
|
render: (renderProps: RenderProps<Object>) => React.Node,
|
75
73
|
variables: Variables,
|
76
|
-
|
74
|
+
};
|
77
75
|
|
78
|
-
type State = {
|
76
|
+
type State = {
|
79
77
|
error: Error | null,
|
80
78
|
prevPropsEnvironment: IEnvironment,
|
81
79
|
prevPropsVariables: Variables,
|
@@ -86,7 +84,7 @@ type State = {|
|
|
86
84
|
retryCallbacks: RetryCallbacks,
|
87
85
|
requestCacheKey: ?string,
|
88
86
|
snapshot: Snapshot | null,
|
89
|
-
|
87
|
+
};
|
90
88
|
|
91
89
|
/**
|
92
90
|
* @public
|
@@ -8,12 +8,10 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
const React = require('react');
|
15
13
|
|
16
|
-
export type ReactRelayQueryRendererContext = {
|
14
|
+
export type ReactRelayQueryRendererContext = {rootIsQueryRenderer: boolean};
|
17
15
|
|
18
16
|
module.exports = (React.createContext({
|
19
17
|
rootIsQueryRenderer: false,
|
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {
|
@@ -364,9 +362,7 @@ function createContainerWithFragments<
|
|
364
362
|
);
|
365
363
|
|
366
364
|
// TODO: T26288752 find a better way
|
367
|
-
/* eslint-disable lint/react-state-props-mutation */
|
368
365
|
this.state.localVariables = fetchVariables;
|
369
|
-
/* eslint-enable lint/react-state-props-mutation */
|
370
366
|
|
371
367
|
// Cancel any previously running refetch.
|
372
368
|
this._refetchSubscription && this._refetchSubscription.unsubscribe();
|
package/ReactRelayTypes.js.flow
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {
|
@@ -29,7 +27,7 @@ export type ObserverOrCallback = Observer<void> | ((error: ?Error) => mixed);
|
|
29
27
|
// RelayRefetchProp to flow into a RelayProp.
|
30
28
|
export type RelayProp = {+environment: IEnvironment, ...};
|
31
29
|
|
32
|
-
export type RelayPaginationProp = {
|
30
|
+
export type RelayPaginationProp = {
|
33
31
|
+environment: IEnvironment,
|
34
32
|
+hasMore: () => boolean,
|
35
33
|
+isLoading: () => boolean,
|
@@ -43,9 +41,9 @@ export type RelayPaginationProp = {|
|
|
43
41
|
observerOrCallback: ?ObserverOrCallback,
|
44
42
|
refetchVariables: ?Variables,
|
45
43
|
) => ?Disposable,
|
46
|
-
|
44
|
+
};
|
47
45
|
|
48
|
-
export type RelayRefetchProp = {
|
46
|
+
export type RelayRefetchProp = {
|
49
47
|
+environment: IEnvironment,
|
50
48
|
+refetch: (
|
51
49
|
refetchVariables: Variables | ((fragmentVariables: Variables) => Variables),
|
@@ -53,13 +51,13 @@ export type RelayRefetchProp = {|
|
|
53
51
|
observerOrCallback: ?ObserverOrCallback,
|
54
52
|
options?: RefetchOptions,
|
55
53
|
) => Disposable,
|
56
|
-
|
54
|
+
};
|
57
55
|
|
58
|
-
export type RefetchOptions = {
|
56
|
+
export type RefetchOptions = {
|
59
57
|
+force?: boolean,
|
60
58
|
+fetchPolicy?: 'store-or-network' | 'network-only',
|
61
59
|
+metadata?: {[key: string]: mixed, ...},
|
62
|
-
|
60
|
+
};
|
63
61
|
|
64
62
|
/**
|
65
63
|
* A utility type which takes the type of a fragment's data (typically found in
|
package/RelayContext.js.flow
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
const {
|
@@ -45,7 +43,7 @@ class BarComponent extends React.Component<{
|
|
45
43
|
requiredProp: string,
|
46
44
|
...
|
47
45
|
}> {
|
48
|
-
static defaultProps = {
|
46
|
+
static defaultProps: {defaultProp: string} = {
|
49
47
|
defaultProp: 'default',
|
50
48
|
};
|
51
49
|
getNum(): number {
|
@@ -127,7 +125,7 @@ module.exports = {
|
|
127
125
|
return <Bar {...props} />;
|
128
126
|
},
|
129
127
|
checkStaticsAndMethodsProxying(): React.Node {
|
130
|
-
class ProxyChecker extends React.PureComponent<{
|
128
|
+
class ProxyChecker extends React.PureComponent<{}> {
|
131
129
|
_barRef: ?BarComponent;
|
132
130
|
getString(): string {
|
133
131
|
const ok = this._barRef ? this._barRef.getNum() : 'default'; // legit
|
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
const {
|
@@ -33,13 +31,13 @@ class FooComponent extends React.Component {
|
|
33
31
|
requiredProp: string,
|
34
32
|
...
|
35
33
|
};
|
36
|
-
static defaultProps = {
|
34
|
+
static defaultProps: {defaultProp: string} = {
|
37
35
|
defaultProp: 'default',
|
38
36
|
};
|
39
37
|
getNum(): number {
|
40
38
|
return 42;
|
41
39
|
}
|
42
|
-
render() {
|
40
|
+
render(): React.Node {
|
43
41
|
const reqLen = this.props.requiredProp.length;
|
44
42
|
const optionalProp = this.props.optionalProp;
|
45
43
|
|
@@ -159,7 +157,7 @@ module.exports = {
|
|
159
157
|
/** $FlowExpectedError: Foo `getNum` gives number, but `getString` assumes string **/
|
160
158
|
return bad ? 'not good' : ok;
|
161
159
|
}
|
162
|
-
render() {
|
160
|
+
render(): React.Node {
|
163
161
|
return (
|
164
162
|
<Foo
|
165
163
|
componentRef={ref => {
|
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
const {
|
@@ -32,13 +30,13 @@ class FooComponent extends React.Component {
|
|
32
30
|
requiredProp: string,
|
33
31
|
...
|
34
32
|
};
|
35
|
-
static defaultProps = {
|
33
|
+
static defaultProps: {defaultProp: string} = {
|
36
34
|
defaultProp: 'default',
|
37
35
|
};
|
38
36
|
getNum(): number {
|
39
37
|
return 42;
|
40
38
|
}
|
41
|
-
render() {
|
39
|
+
render(): React.Node {
|
42
40
|
const reqLen = this.props.requiredProp.length;
|
43
41
|
const optionalProp = this.props.optionalProp;
|
44
42
|
|
@@ -142,7 +140,7 @@ module.exports = {
|
|
142
140
|
/** $FlowExpectedError: Foo `getNum` gives number, but `getString` assumes string **/
|
143
141
|
return bad ? 'not good' : ok;
|
144
142
|
}
|
145
|
-
render() {
|
143
|
+
render(): React.Node {
|
146
144
|
return (
|
147
145
|
<Foo
|
148
146
|
componentRef={ref => {
|
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {$FragmentRef} from '../ReactRelayTypes';
|
@@ -252,9 +250,9 @@ declare var aComplexUserRef: {
|
|
252
250
|
optionalUsers={null}
|
253
251
|
/>;
|
254
252
|
|
255
|
-
class AnyTest extends React.Component<{
|
253
|
+
class AnyTest extends React.Component<{
|
256
254
|
anything: any,
|
257
|
-
|
255
|
+
}> {}
|
258
256
|
const AnyTestContainer = createFragmentContainer(AnyTest, {});
|
259
257
|
|
260
258
|
<AnyTestContainer anything={42} />;
|
@@ -8,16 +8,14 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {RelayModernFlowtest_user$ref} from './RelayModernFlowtest_user.graphql';
|
16
14
|
import type {FragmentType} from 'relay-runtime';
|
17
15
|
|
18
16
|
declare export opaque type RelayModernFlowtest_badref$ref: FragmentType;
|
19
|
-
export type RelayModernFlowtest_badref = {
|
17
|
+
export type RelayModernFlowtest_badref = {
|
20
18
|
+id: string,
|
21
19
|
+$fragmentSpreads: RelayModernFlowtest_user$ref,
|
22
20
|
+$fragmentType: RelayModernFlowtest_badref$ref,
|
23
|
-
|
21
|
+
};
|
@@ -8,16 +8,14 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {RelayModernFlowtest_user$ref} from './RelayModernFlowtest_user.graphql';
|
16
14
|
import type {FragmentType} from 'relay-runtime';
|
17
15
|
|
18
16
|
declare export opaque type RelayModernFlowtest_notref$ref: FragmentType;
|
19
|
-
export type RelayModernFlowtest_notref = {
|
17
|
+
export type RelayModernFlowtest_notref = {
|
20
18
|
+id: string,
|
21
19
|
+$fragmentSpreads: RelayModernFlowtest_user$ref,
|
22
20
|
+$fragmentType: RelayModernFlowtest_notref$ref,
|
23
|
-
|
21
|
+
};
|
@@ -8,14 +8,12 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {FragmentType} from 'relay-runtime';
|
16
14
|
|
17
15
|
declare export opaque type RelayModernFlowtest_user$ref: FragmentType;
|
18
|
-
export type RelayModernFlowtest_user = {
|
16
|
+
export type RelayModernFlowtest_user = {
|
19
17
|
+name: ?string,
|
20
18
|
+$fragmentType: RelayModernFlowtest_user$ref,
|
21
|
-
|
19
|
+
};
|
@@ -8,14 +8,12 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
import type {FragmentType} from 'relay-runtime';
|
16
14
|
|
17
15
|
declare export opaque type RelayModernFlowtest_users$ref: FragmentType;
|
18
|
-
export type RelayModernFlowtest_users = $ReadOnlyArray<{
|
16
|
+
export type RelayModernFlowtest_users = $ReadOnlyArray<{
|
19
17
|
+name: ?string,
|
20
18
|
+$fragmentType: RelayModernFlowtest_users$ref,
|
21
|
-
|
19
|
+
}>;
|
package/hooks.js
CHANGED
package/hooks.js.flow
CHANGED
package/index.js
CHANGED
package/index.js.flow
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
const ReactRelayContext = require('./ReactRelayContext');
|
@@ -22,6 +20,7 @@ const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
|
22
20
|
const loadEntryPoint = require('./relay-hooks/loadEntryPoint');
|
23
21
|
const {loadQuery} = require('./relay-hooks/loadQuery');
|
24
22
|
const RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
23
|
+
const useClientQuery = require('./relay-hooks/useClientQuery');
|
25
24
|
const useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
|
26
25
|
const useFragment = require('./relay-hooks/useFragment');
|
27
26
|
const useLazyLoadQuery = require('./relay-hooks/useLazyLoadQuery');
|
@@ -113,6 +112,7 @@ module.exports = {
|
|
113
112
|
loadQuery: loadQuery,
|
114
113
|
loadEntryPoint: loadEntryPoint,
|
115
114
|
|
115
|
+
useClientQuery: useClientQuery,
|
116
116
|
useFragment: useFragment,
|
117
117
|
useLazyLoadQuery: useLazyLoadQuery,
|
118
118
|
useEntryPointLoader: useEntryPointLoader,
|
package/legacy.js
CHANGED
package/legacy.js.flow
CHANGED