react-relay 14.1.0 → 16.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ReactRelayContainerUtils.js.flow +1 -0
- package/ReactRelayContext.js +1 -1
- package/ReactRelayContext.js.flow +1 -0
- package/ReactRelayFragmentContainer.js.flow +6 -2
- package/ReactRelayFragmentMockRenderer.js.flow +1 -0
- package/ReactRelayLocalQueryRenderer.js.flow +5 -3
- package/ReactRelayPaginationContainer.js.flow +21 -12
- package/ReactRelayQueryFetcher.js.flow +20 -10
- package/ReactRelayQueryRenderer.js.flow +15 -11
- package/ReactRelayQueryRendererContext.js.flow +1 -0
- package/ReactRelayRefetchContainer.js.flow +9 -5
- package/ReactRelayTestMocker.js.flow +3 -1
- package/ReactRelayTypes.js.flow +2 -0
- package/RelayContext.js.flow +1 -0
- package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -1
- package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +1 -0
- package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +1 -0
- package/__flowtests__/RelayModern-flowtest.js.flow +1 -0
- package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +1 -0
- package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +1 -0
- package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +1 -0
- package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +1 -0
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +3 -1
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +3 -1
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +4 -2
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +3 -1
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +4 -2
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +3 -1
- package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +4 -2
- package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +4 -2
- package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +3 -1
- package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +3 -1
- package/assertFragmentMap.js.flow +1 -0
- package/buildReactRelayContainer.js.flow +10 -6
- package/getRootVariablesForFragments.js.flow +1 -1
- package/hooks.js +1 -1
- package/hooks.js.flow +4 -0
- package/index.js +1 -1
- package/index.js.flow +4 -0
- package/isRelayEnvironment.js.flow +1 -0
- package/jest-react/enqueueTask.js.flow +1 -1
- package/jest-react/index.js.flow +1 -1
- package/jest-react/internalAct.js.flow +1 -1
- package/legacy.js +1 -1
- package/legacy.js.flow +1 -0
- package/lib/ReactRelayContainerUtils.js +0 -11
- package/lib/ReactRelayContext.js +1 -12
- package/lib/ReactRelayFragmentContainer.js +23 -122
- package/lib/ReactRelayFragmentMockRenderer.js +0 -12
- package/lib/ReactRelayLocalQueryRenderer.js +12 -41
- package/lib/ReactRelayPaginationContainer.js +45 -341
- package/lib/ReactRelayQueryFetcher.js +36 -111
- package/lib/ReactRelayQueryRenderer.js +29 -137
- package/lib/ReactRelayQueryRendererContext.js +0 -10
- package/lib/ReactRelayRefetchContainer.js +33 -166
- package/lib/ReactRelayTestMocker.js +18 -128
- package/lib/ReactRelayTypes.js +0 -9
- package/lib/RelayContext.js +0 -23
- package/lib/assertFragmentMap.js +0 -16
- package/lib/buildReactRelayContainer.js +7 -41
- package/lib/getRootVariablesForFragments.js +2 -19
- package/lib/hooks.js +3 -30
- package/lib/index.js +3 -39
- package/lib/isRelayEnvironment.js +1 -16
- package/lib/jest-react/enqueueTask.js +1 -25
- package/lib/jest-react/index.js +0 -1
- package/lib/jest-react/internalAct.js +2 -51
- package/lib/legacy.js +0 -20
- package/lib/multi-actor/ActorChange.js +0 -14
- package/lib/multi-actor/index.js +0 -10
- package/lib/multi-actor/useRelayActorEnvironment.js +2 -16
- package/lib/relay-hooks/EntryPointContainer.react.js +7 -23
- package/lib/relay-hooks/EntryPointTypes.flow.js +0 -10
- package/lib/relay-hooks/FragmentResource.js +130 -280
- package/lib/relay-hooks/HooksImplementation.js +0 -14
- package/lib/relay-hooks/InternalLogger.js +0 -11
- package/lib/relay-hooks/LRUCache.js +0 -39
- package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +27 -65
- package/lib/relay-hooks/MatchContainer.js +9 -111
- package/lib/relay-hooks/NestedRelayEntryPointBuilderUtils.js +9 -0
- package/lib/relay-hooks/ProfilerContext.js +0 -14
- package/lib/relay-hooks/QueryResource.js +14 -149
- package/lib/relay-hooks/RelayEnvironmentProvider.js +3 -17
- package/lib/relay-hooks/SuspenseResource.js +2 -59
- package/lib/relay-hooks/loadEntryPoint.js +10 -45
- package/lib/relay-hooks/loadQuery.js +29 -169
- package/lib/relay-hooks/preloadQuery_DEPRECATED.js +8 -58
- package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +6 -24
- package/lib/relay-hooks/react-cache/RelayReactCache.js +4 -20
- package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +13 -102
- package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +18 -75
- package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +79 -222
- package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +3 -27
- package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +11 -33
- package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +62 -85
- package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +20 -63
- package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +53 -179
- package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +5 -27
- package/lib/relay-hooks/useBlockingPaginationFragment.js +58 -121
- package/lib/relay-hooks/useClientQuery.js +0 -21
- package/lib/relay-hooks/useEntryPointLoader.js +12 -100
- package/lib/relay-hooks/useFetchTrackingRef.js +6 -33
- package/lib/relay-hooks/useFragment.js +5 -32
- package/lib/relay-hooks/useFragmentNode.js +14 -55
- package/lib/relay-hooks/useIsMountedRef.js +2 -14
- package/lib/relay-hooks/useIsOperationNodeActive.js +6 -29
- package/lib/relay-hooks/useIsParentQueryActive.js +1 -15
- package/lib/relay-hooks/useLazyLoadQuery.js +2 -23
- package/lib/relay-hooks/useLazyLoadQueryNode.js +18 -63
- package/lib/relay-hooks/useLoadMoreFunction.js +44 -100
- package/lib/relay-hooks/useMemoOperationDescriptor.js +4 -23
- package/lib/relay-hooks/useMemoVariables.js +8 -43
- package/lib/relay-hooks/useMutation.js +6 -34
- package/lib/relay-hooks/usePaginationFragment.js +49 -89
- package/lib/relay-hooks/usePreloadedQuery.js +10 -54
- package/lib/relay-hooks/useQueryLoader.js +18 -116
- package/lib/relay-hooks/useRefetchableFragment.js +4 -30
- package/lib/relay-hooks/useRefetchableFragmentNode.js +58 -184
- package/lib/relay-hooks/useRelayEnvironment.js +2 -16
- package/lib/relay-hooks/useStaticFragmentNodeWarning.js +2 -20
- package/lib/relay-hooks/useSubscribeToInvalidationState.js +3 -28
- package/lib/relay-hooks/useSubscription.js +3 -22
- package/lib/relay-hooks/useUnsafeRef_DEPRECATED.js +12 -0
- package/multi-actor/ActorChange.js.flow +1 -1
- package/multi-actor/index.js.flow +1 -1
- package/multi-actor/useRelayActorEnvironment.js.flow +2 -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/relay-hooks/EntryPointContainer.react.js.flow +6 -1
- package/relay-hooks/EntryPointTypes.flow.js.flow +23 -20
- package/relay-hooks/FragmentResource.js.flow +148 -34
- package/relay-hooks/HooksImplementation.js.flow +1 -1
- package/relay-hooks/InternalLogger.js.flow +1 -1
- package/relay-hooks/LRUCache.js.flow +1 -1
- package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +19 -10
- package/relay-hooks/MatchContainer.js.flow +1 -1
- package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +51 -0
- package/relay-hooks/ProfilerContext.js.flow +1 -1
- package/relay-hooks/QueryResource.js.flow +25 -5
- package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -2
- package/relay-hooks/SuspenseResource.js.flow +1 -1
- package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -1
- package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +9 -7
- package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +3 -1
- package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +3 -1
- package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +40 -33
- package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +1 -1
- package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +38 -32
- package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +20 -18
- package/relay-hooks/__flowtests__/utils.js.flow +13 -2
- package/relay-hooks/loadEntryPoint.js.flow +15 -8
- package/relay-hooks/loadQuery.js.flow +32 -8
- package/relay-hooks/preloadQuery_DEPRECATED.js.flow +5 -6
- package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +17 -10
- package/relay-hooks/react-cache/RelayReactCache.js.flow +1 -1
- package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +4 -4
- package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +5 -4
- package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +32 -14
- package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +4 -10
- package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +1 -1
- package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +39 -49
- package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +1 -2
- package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +29 -16
- package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +17 -33
- package/relay-hooks/useBlockingPaginationFragment.js.flow +85 -58
- package/relay-hooks/useClientQuery.js.flow +3 -3
- package/relay-hooks/useEntryPointLoader.js.flow +10 -6
- package/relay-hooks/useFetchTrackingRef.js.flow +5 -4
- package/relay-hooks/useFragment.js.flow +2 -2
- package/relay-hooks/useFragmentNode.js.flow +7 -6
- package/relay-hooks/useIsMountedRef.js.flow +1 -1
- package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
- package/relay-hooks/useIsParentQueryActive.js.flow +1 -1
- package/relay-hooks/useLazyLoadQuery.js.flow +2 -2
- package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -2
- package/relay-hooks/useLoadMoreFunction.js.flow +27 -16
- package/relay-hooks/useMemoOperationDescriptor.js.flow +3 -3
- package/relay-hooks/useMemoVariables.js.flow +13 -29
- package/relay-hooks/useMutation.js.flow +30 -13
- package/relay-hooks/usePaginationFragment.js.flow +55 -54
- package/relay-hooks/usePreloadedQuery.js.flow +47 -22
- package/relay-hooks/useQueryLoader.js.flow +78 -21
- package/relay-hooks/useRefetchableFragment.js.flow +65 -33
- package/relay-hooks/useRefetchableFragmentNode.js.flow +38 -17
- package/relay-hooks/useRelayEnvironment.js.flow +2 -2
- package/relay-hooks/useStaticFragmentNodeWarning.js.flow +3 -3
- package/relay-hooks/useSubscribeToInvalidationState.js.flow +2 -2
- package/relay-hooks/useSubscription.js.flow +1 -1
- package/relay-hooks/useUnsafeRef_DEPRECATED.js.flow +25 -0
- package/lib/readContext.js +0 -27
- package/readContext.js.flow +0 -29
@@ -1,53 +1,29 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
* @emails oncall+relay
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
// This file is sync'd from https://github.com/facebook/react/tree/main/packages/jest-react
|
11
1
|
'use strict';
|
12
2
|
|
13
3
|
var didWarnAboutMessageChannel = false;
|
14
4
|
var enqueueTaskImpl = null;
|
15
|
-
|
16
5
|
function enqueueTask(task) {
|
17
6
|
if (enqueueTaskImpl === null) {
|
18
7
|
try {
|
19
|
-
// read require off the module object to get around the bundlers.
|
20
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
21
8
|
var requireString = ('require' + Math.random()).slice(0, 7);
|
22
|
-
var nodeRequire = module && module[requireString];
|
23
|
-
// version of setImmediate, bypassing fake timers if any.
|
24
|
-
|
9
|
+
var nodeRequire = module && module[requireString];
|
25
10
|
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
26
11
|
} catch (_unused) {
|
27
|
-
// we're in a browser
|
28
|
-
// we can't use regular timers because they may still be faked
|
29
|
-
// so we try MessageChannel+postMessage instead
|
30
12
|
enqueueTaskImpl = function enqueueTaskImpl(callback) {
|
31
13
|
if (process.env.NODE_ENV !== "production") {
|
32
14
|
if (didWarnAboutMessageChannel === false) {
|
33
15
|
didWarnAboutMessageChannel = true;
|
34
|
-
|
35
16
|
if (typeof MessageChannel === 'undefined') {
|
36
17
|
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
37
18
|
}
|
38
19
|
}
|
39
20
|
}
|
40
|
-
/*global MessageChannel*/
|
41
|
-
|
42
|
-
|
43
21
|
var channel = new MessageChannel();
|
44
22
|
channel.port1.onmessage = callback;
|
45
23
|
channel.port2.postMessage(undefined);
|
46
24
|
};
|
47
25
|
}
|
48
26
|
}
|
49
|
-
|
50
27
|
return enqueueTaskImpl(task);
|
51
28
|
}
|
52
|
-
|
53
29
|
module.exports = enqueueTask;
|
package/lib/jest-react/index.js
CHANGED
@@ -1,73 +1,34 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
* @emails oncall+relay
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
/* global jest */
|
12
|
-
// This file is sync'd from https://github.com/facebook/react/tree/main/packages/jest-react
|
13
|
-
// This version of `act` is only used by our tests. Unlike the public version
|
14
|
-
// of `act`, it's designed to work identically in both production and
|
15
|
-
// development. It may have slightly different behavior from the public
|
16
|
-
// version, too, since our constraints in our test suite are not the same as
|
17
|
-
// those of developers using React — we're testing React itself, as opposed to
|
18
|
-
// building an app with React.
|
19
1
|
'use strict';
|
20
2
|
|
21
3
|
var enqueueTask = require('./enqueueTask');
|
22
|
-
|
23
|
-
var Scheduler = require('scheduler/unstable_mock'); // The subset of a Promise that React APIs rely on. This resolves a value.
|
24
|
-
// This doesn't require a return value neither from the handler nor the
|
25
|
-
// then function.
|
26
|
-
|
27
|
-
|
4
|
+
var Scheduler = require('scheduler/unstable_mock');
|
28
5
|
var actingUpdatesScopeDepth = 0;
|
29
|
-
|
30
6
|
function act(scope) {
|
31
7
|
if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
32
8
|
throw Error('This version of `act` requires a special mock build of Scheduler.');
|
33
9
|
}
|
34
|
-
|
35
10
|
if (setTimeout._isMockFunction !== true) {
|
36
11
|
throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
|
37
12
|
}
|
38
|
-
|
39
13
|
var previousIsActEnvironment = global.IS_REACT_ACT_ENVIRONMENT;
|
40
14
|
var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
|
41
15
|
actingUpdatesScopeDepth++;
|
42
|
-
|
43
16
|
if (process.env.NODE_ENV !== "production" && actingUpdatesScopeDepth === 1) {
|
44
|
-
// Because this is not the "real" `act`, we set this to `false` so React
|
45
|
-
// knows not to fire `act` warnings.
|
46
17
|
global.IS_REACT_ACT_ENVIRONMENT = false;
|
47
18
|
}
|
48
|
-
|
49
19
|
var unwind = function unwind() {
|
50
20
|
if (process.env.NODE_ENV !== "production" && actingUpdatesScopeDepth === 1) {
|
51
21
|
global.IS_REACT_ACT_ENVIRONMENT = previousIsActEnvironment;
|
52
22
|
}
|
53
|
-
|
54
23
|
actingUpdatesScopeDepth--;
|
55
|
-
|
56
24
|
if (process.env.NODE_ENV !== "production") {
|
57
25
|
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
|
58
|
-
// if it's _less than_ previousActingUpdatesScopeDepth, then we can
|
59
|
-
// assume the 'other' one has warned
|
60
26
|
console.error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
61
27
|
}
|
62
28
|
}
|
63
|
-
};
|
64
|
-
// returned and 2) we could use async/await. Since it's only our used in
|
65
|
-
// our test suite, we should be able to.
|
66
|
-
|
67
|
-
|
29
|
+
};
|
68
30
|
try {
|
69
31
|
var result = scope();
|
70
|
-
|
71
32
|
if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
|
72
33
|
var thenableResult = result;
|
73
34
|
return {
|
@@ -88,16 +49,11 @@ function act(scope) {
|
|
88
49
|
};
|
89
50
|
} else {
|
90
51
|
var returnValue = result;
|
91
|
-
|
92
52
|
try {
|
93
|
-
// TODO: Let's not support non-async scopes at all in our tests. Need to
|
94
|
-
// migrate existing tests.
|
95
53
|
var didFlushWork;
|
96
|
-
|
97
54
|
do {
|
98
55
|
didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
99
56
|
} while (didFlushWork);
|
100
|
-
|
101
57
|
return {
|
102
58
|
then: function then(resolve, reject) {
|
103
59
|
resolve(returnValue);
|
@@ -112,15 +68,11 @@ function act(scope) {
|
|
112
68
|
throw error;
|
113
69
|
}
|
114
70
|
}
|
115
|
-
|
116
71
|
function flushActWork(resolve, reject) {
|
117
|
-
// Flush suspended fallbacks
|
118
|
-
// $FlowFixMe: Flow doesn't know about global Jest object
|
119
72
|
jest.runOnlyPendingTimers();
|
120
73
|
enqueueTask(function () {
|
121
74
|
try {
|
122
75
|
var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
123
|
-
|
124
76
|
if (didFlushWork) {
|
125
77
|
flushActWork(resolve, reject);
|
126
78
|
} else {
|
@@ -131,5 +83,4 @@ function flushActWork(resolve, reject) {
|
|
131
83
|
}
|
132
84
|
});
|
133
85
|
}
|
134
|
-
|
135
86
|
exports.act = act;
|
package/lib/legacy.js
CHANGED
@@ -1,32 +1,12 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* @format
|
9
|
-
*/
|
10
1
|
'use strict';
|
11
2
|
|
12
3
|
var ReactRelayContext = require('./ReactRelayContext');
|
13
|
-
|
14
4
|
var ReactRelayFragmentContainer = require('./ReactRelayFragmentContainer');
|
15
|
-
|
16
5
|
var ReactRelayLocalQueryRenderer = require('./ReactRelayLocalQueryRenderer');
|
17
|
-
|
18
6
|
var ReactRelayPaginationContainer = require('./ReactRelayPaginationContainer');
|
19
|
-
|
20
7
|
var ReactRelayQueryRenderer = require('./ReactRelayQueryRenderer');
|
21
|
-
|
22
8
|
var ReactRelayRefetchContainer = require('./ReactRelayRefetchContainer');
|
23
|
-
|
24
9
|
var RelayRuntime = require('relay-runtime');
|
25
|
-
|
26
|
-
/**
|
27
|
-
* Legacy react-relay exports.
|
28
|
-
* Should prefer using interface defined in ./hooks.js
|
29
|
-
*/
|
30
10
|
module.exports = {
|
31
11
|
ConnectionHandler: RelayRuntime.ConnectionHandler,
|
32
12
|
QueryRenderer: ReactRelayQueryRenderer,
|
@@ -1,21 +1,8 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* @emails oncall+relay
|
9
|
-
* @format
|
10
|
-
*/
|
11
1
|
'use strict';
|
12
2
|
|
13
3
|
var RelayEnvironmentProvider = require('../relay-hooks/RelayEnvironmentProvider');
|
14
|
-
|
15
4
|
var useRelayActorEnvironment = require('./useRelayActorEnvironment');
|
16
|
-
|
17
5
|
var React = require('react');
|
18
|
-
|
19
6
|
function ActorChange(props) {
|
20
7
|
var actorEnvironment = useRelayActorEnvironment(props.actorChangePoint.__viewer);
|
21
8
|
var getEnvironmentForActor = React.useCallback(function (actorIdentifier) {
|
@@ -26,5 +13,4 @@ function ActorChange(props) {
|
|
26
13
|
getEnvironmentForActor: getEnvironmentForActor
|
27
14
|
}, props.children(props.actorChangePoint.__fragmentRef, props.actorChangePoint.__viewer));
|
28
15
|
}
|
29
|
-
|
30
16
|
module.exports = ActorChange;
|
package/lib/multi-actor/index.js
CHANGED
@@ -1,22 +1,9 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
* @emails oncall+relay
|
8
|
-
*
|
9
|
-
* @format
|
10
|
-
*/
|
11
1
|
'use strict';
|
12
2
|
|
3
|
+
var ReactRelayContext = require('./../ReactRelayContext');
|
13
4
|
var invariant = require('invariant');
|
14
|
-
|
15
5
|
var _require = require('react'),
|
16
|
-
|
17
|
-
|
18
|
-
var ReactRelayContext = require('react-relay/ReactRelayContext');
|
19
|
-
|
6
|
+
useContext = _require.useContext;
|
20
7
|
function useRelayActorEnvironment(actorIdentifier) {
|
21
8
|
var context = useContext(ReactRelayContext);
|
22
9
|
!(context != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'useRelayActorEnvironment: Expected to have found a Relay environment provided by ' + 'a `RelayEnvironmentProvider` component. ' + 'This usually means that useRelayActorEnvironment was used in a ' + 'component that is not a descendant of a `RelayEnvironmentProvider`. ' + 'Please make sure a `RelayEnvironmentProvider` has been rendered somewhere ' + 'as a parent or ancestor of your component.') : invariant(false) : void 0;
|
@@ -24,5 +11,4 @@ function useRelayActorEnvironment(actorIdentifier) {
|
|
24
11
|
!(getEnvironmentForActor != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'useRelayActorEnvironment: Expected to have a function `getEnvironmentForActor`.' + 'This usually means that `RelayEnvironmentProvider`. was not properly set up for use in the ' + 'multi actor application. Please make sure the provider has defined a `getEnvironmentForActor`.') : invariant(false) : void 0;
|
25
12
|
return getEnvironmentForActor(actorIdentifier);
|
26
13
|
}
|
27
|
-
|
28
14
|
module.exports = useRelayActorEnvironment;
|
@@ -1,36 +1,21 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
* @emails oncall+relay
|
8
|
-
*
|
9
|
-
* @format
|
10
|
-
*/
|
11
1
|
'use strict';
|
12
2
|
|
13
3
|
var ProfilerContext = require('./ProfilerContext');
|
14
|
-
|
15
4
|
var useRelayEnvironment = require('./useRelayEnvironment');
|
16
|
-
|
17
5
|
var React = require('react');
|
18
|
-
|
19
6
|
var _require = require('react'),
|
20
|
-
|
21
|
-
|
22
|
-
|
7
|
+
useContext = _require.useContext,
|
8
|
+
useEffect = _require.useEffect;
|
23
9
|
var warning = require("fbjs/lib/warning");
|
24
|
-
|
25
10
|
function EntryPointContainer(_ref) {
|
26
11
|
var entryPointReference = _ref.entryPointReference,
|
27
|
-
|
12
|
+
props = _ref.props;
|
28
13
|
process.env.NODE_ENV !== "production" ? warning(entryPointReference.isDisposed === false, '<EntryPointContainer>: Expected entryPointReference to not be disposed ' + 'yet. This is because disposing the entrypoint marks it for future garbage ' + 'collection, and as such may no longer be present in the Relay store. ' + 'In the future, this will become a hard error.') : void 0;
|
29
14
|
var getComponent = entryPointReference.getComponent,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
15
|
+
queries = entryPointReference.queries,
|
16
|
+
entryPoints = entryPointReference.entryPoints,
|
17
|
+
extraProps = entryPointReference.extraProps,
|
18
|
+
rootModuleID = entryPointReference.rootModuleID;
|
34
19
|
var Component = getComponent();
|
35
20
|
var profilerContext = useContext(ProfilerContext);
|
36
21
|
var environment = useRelayEnvironment();
|
@@ -48,5 +33,4 @@ function EntryPointContainer(_ref) {
|
|
48
33
|
queries: queries
|
49
34
|
});
|
50
35
|
}
|
51
|
-
|
52
36
|
module.exports = EntryPointContainer;
|