react-relay 11.0.0 → 13.0.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. package/ReactRelayContext.js +1 -1
  2. package/ReactRelayContext.js.flow +2 -3
  3. package/ReactRelayFragmentContainer.js.flow +24 -24
  4. package/ReactRelayFragmentMockRenderer.js.flow +1 -1
  5. package/ReactRelayLocalQueryRenderer.js.flow +7 -8
  6. package/ReactRelayPaginationContainer.js.flow +111 -54
  7. package/ReactRelayQueryFetcher.js.flow +9 -10
  8. package/ReactRelayQueryRenderer.js.flow +115 -81
  9. package/ReactRelayRefetchContainer.js.flow +40 -35
  10. package/ReactRelayTestMocker.js.flow +16 -12
  11. package/ReactRelayTypes.js.flow +10 -10
  12. package/RelayContext.js.flow +3 -3
  13. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +1 -2
  14. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +12 -7
  15. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +10 -6
  16. package/__flowtests__/RelayModern-flowtest.js.flow +78 -46
  17. package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +5 -4
  18. package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +5 -4
  19. package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +4 -3
  20. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +4 -3
  21. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +72 -0
  22. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +72 -0
  23. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +227 -0
  24. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +164 -0
  25. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +227 -0
  26. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +164 -0
  27. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +66 -0
  28. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +66 -0
  29. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +59 -0
  30. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +61 -0
  31. package/assertFragmentMap.js.flow +2 -2
  32. package/buildReactRelayContainer.js.flow +15 -12
  33. package/getRootVariablesForFragments.js.flow +2 -3
  34. package/hooks.js +1 -1
  35. package/hooks.js.flow +5 -6
  36. package/index.js +1 -1
  37. package/index.js.flow +6 -7
  38. package/jest-react/enqueueTask.js.flow +56 -0
  39. package/jest-react/index.js.flow +12 -0
  40. package/jest-react/internalAct.js.flow +139 -0
  41. package/legacy.js +1 -1
  42. package/lib/ReactRelayFragmentContainer.js +21 -15
  43. package/lib/ReactRelayFragmentMockRenderer.js +2 -2
  44. package/lib/ReactRelayLocalQueryRenderer.js +7 -8
  45. package/lib/ReactRelayPaginationContainer.js +92 -30
  46. package/lib/ReactRelayQueryFetcher.js +3 -3
  47. package/lib/ReactRelayQueryRenderer.js +86 -53
  48. package/lib/ReactRelayRefetchContainer.js +36 -21
  49. package/lib/ReactRelayTestMocker.js +7 -6
  50. package/lib/RelayContext.js +3 -2
  51. package/lib/assertFragmentMap.js +3 -2
  52. package/lib/buildReactRelayContainer.js +14 -11
  53. package/lib/hooks.js +5 -5
  54. package/lib/index.js +7 -7
  55. package/lib/jest-react/enqueueTask.js +53 -0
  56. package/lib/jest-react/index.js +13 -0
  57. package/lib/jest-react/internalAct.js +116 -0
  58. package/lib/multi-actor/ActorChange.js +30 -0
  59. package/lib/multi-actor/index.js +11 -0
  60. package/lib/multi-actor/useRelayActorEnvironment.js +29 -0
  61. package/lib/relay-hooks/EntryPointContainer.react.js +3 -3
  62. package/lib/relay-hooks/FragmentResource.js +351 -94
  63. package/lib/relay-hooks/LRUCache.js +1 -1
  64. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +4 -4
  65. package/lib/relay-hooks/MatchContainer.js +1 -1
  66. package/lib/relay-hooks/QueryResource.js +172 -29
  67. package/lib/relay-hooks/RelayEnvironmentProvider.js +5 -3
  68. package/lib/relay-hooks/SuspenseResource.js +130 -0
  69. package/lib/relay-hooks/loadQuery.js +42 -20
  70. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +24 -15
  71. package/lib/relay-hooks/useBlockingPaginationFragment.js +4 -5
  72. package/lib/relay-hooks/useEntryPointLoader.js +2 -2
  73. package/lib/relay-hooks/useFetchTrackingRef.js +2 -1
  74. package/lib/relay-hooks/useFragment.js +8 -7
  75. package/lib/relay-hooks/useFragmentNode.js +4 -4
  76. package/lib/relay-hooks/useIsOperationNodeActive.js +3 -3
  77. package/lib/relay-hooks/useLazyLoadQuery.js +3 -3
  78. package/lib/relay-hooks/useLazyLoadQueryNode.js +10 -4
  79. package/lib/relay-hooks/useLoadMoreFunction.js +6 -8
  80. package/lib/relay-hooks/useMemoOperationDescriptor.js +2 -2
  81. package/lib/relay-hooks/useMemoVariables.js +2 -2
  82. package/lib/relay-hooks/useMutation.js +17 -6
  83. package/lib/relay-hooks/usePaginationFragment.js +2 -3
  84. package/lib/relay-hooks/usePreloadedQuery.js +8 -7
  85. package/lib/relay-hooks/useQueryLoader.js +30 -10
  86. package/lib/relay-hooks/useRefetchableFragmentNode.js +12 -14
  87. package/lib/relay-hooks/useRelayEnvironment.js +3 -3
  88. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +2 -2
  89. package/lib/relay-hooks/useSubscribeToInvalidationState.js +2 -1
  90. package/lib/relay-hooks/useSubscription.js +10 -7
  91. package/multi-actor/ActorChange.js.flow +58 -0
  92. package/multi-actor/index.js.flow +14 -0
  93. package/multi-actor/useRelayActorEnvironment.js.flow +49 -0
  94. package/package.json +3 -2
  95. package/react-relay-hooks.js +2 -2
  96. package/react-relay-hooks.min.js +2 -2
  97. package/react-relay-legacy.js +2 -2
  98. package/react-relay-legacy.min.js +2 -2
  99. package/react-relay.js +2 -2
  100. package/react-relay.min.js +2 -2
  101. package/relay-hooks/EntryPointContainer.react.js.flow +8 -15
  102. package/relay-hooks/EntryPointTypes.flow.js.flow +24 -25
  103. package/relay-hooks/FragmentResource.js.flow +376 -95
  104. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +32 -46
  105. package/relay-hooks/MatchContainer.js.flow +3 -2
  106. package/relay-hooks/QueryResource.js.flow +216 -25
  107. package/relay-hooks/RelayEnvironmentProvider.js.flow +14 -4
  108. package/relay-hooks/SuspenseResource.js.flow +115 -0
  109. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +4 -3
  110. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +1 -1
  111. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +10 -9
  112. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +8 -7
  113. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +10 -9
  114. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +10 -9
  115. package/relay-hooks/__flowtests__/utils.js.flow +8 -12
  116. package/relay-hooks/loadEntryPoint.js.flow +6 -12
  117. package/relay-hooks/loadQuery.js.flow +49 -31
  118. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +30 -21
  119. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +6 -12
  120. package/relay-hooks/useBlockingPaginationFragment.js.flow +13 -11
  121. package/relay-hooks/useEntryPointLoader.js.flow +7 -10
  122. package/relay-hooks/useFetchTrackingRef.js.flow +2 -2
  123. package/relay-hooks/useFragment.js.flow +26 -46
  124. package/relay-hooks/useFragmentNode.js.flow +5 -7
  125. package/relay-hooks/useIsOperationNodeActive.js.flow +3 -5
  126. package/relay-hooks/useIsParentQueryActive.js.flow +3 -4
  127. package/relay-hooks/useLazyLoadQuery.js.flow +9 -10
  128. package/relay-hooks/useLazyLoadQueryNode.js.flow +19 -13
  129. package/relay-hooks/useLoadMoreFunction.js.flow +20 -27
  130. package/relay-hooks/useMemoOperationDescriptor.js.flow +5 -7
  131. package/relay-hooks/useMemoVariables.js.flow +6 -6
  132. package/relay-hooks/useMutation.js.flow +26 -26
  133. package/relay-hooks/usePaginationFragment.js.flow +38 -44
  134. package/relay-hooks/usePreloadedQuery.js.flow +18 -14
  135. package/relay-hooks/useQueryLoader.js.flow +41 -22
  136. package/relay-hooks/useRefetchableFragment.js.flow +7 -8
  137. package/relay-hooks/useRefetchableFragmentNode.js.flow +24 -30
  138. package/relay-hooks/useRelayEnvironment.js.flow +2 -4
  139. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +2 -3
  140. package/relay-hooks/useSubscribeToInvalidationState.js.flow +3 -6
  141. package/relay-hooks/useSubscription.js.flow +20 -10
  142. package/lib/relay-hooks/getPaginationMetadata.js +0 -41
  143. package/lib/relay-hooks/getPaginationVariables.js +0 -66
  144. package/lib/relay-hooks/getRefetchMetadata.js +0 -36
  145. package/lib/relay-hooks/getValueAtPath.js +0 -51
  146. package/relay-hooks/getPaginationMetadata.js.flow +0 -74
  147. package/relay-hooks/getPaginationVariables.js.flow +0 -108
  148. package/relay-hooks/getRefetchMetadata.js.flow +0 -80
  149. package/relay-hooks/getValueAtPath.js.flow +0 -46
@@ -14,23 +14,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
14
14
 
15
15
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
16
 
17
- var React = require('react');
17
+ var assertFragmentMap = require('./assertFragmentMap');
18
+
19
+ var _require = require('./ReactRelayContainerUtils'),
20
+ getComponentName = _require.getComponentName,
21
+ getContainerName = _require.getContainerName;
18
22
 
19
23
  var ReactRelayContext = require('./ReactRelayContext');
20
24
 
21
25
  var ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext');
22
26
 
23
- var assertFragmentMap = require('./assertFragmentMap');
24
-
25
- var invariant = require("fbjs/lib/invariant");
26
-
27
- var mapObject = require("fbjs/lib/mapObject");
28
-
29
27
  var readContext = require('./readContext');
30
28
 
31
- var _require = require('./ReactRelayContainerUtils'),
32
- getComponentName = _require.getComponentName,
33
- getContainerName = _require.getContainerName;
29
+ var invariant = require('invariant');
30
+
31
+ var React = require('react');
34
32
 
35
33
  var _require2 = require('relay-runtime'),
36
34
  getFragment = _require2.getFragment;
@@ -43,7 +41,12 @@ function buildReactRelayContainer(ComponentClass, fragmentSpec, createContainerW
43
41
  // Sanity-check user-defined fragment input
44
42
  var containerName = getContainerName(ComponentClass);
45
43
  assertFragmentMap(getComponentName(ComponentClass), fragmentSpec);
46
- var fragments = mapObject(fragmentSpec, getFragment);
44
+ var fragments = {};
45
+
46
+ for (var key in fragmentSpec) {
47
+ fragments[key] = getFragment(fragmentSpec[key]);
48
+ }
49
+
47
50
  var Container = createContainerWithFragments(ComponentClass, fragments);
48
51
  Container.displayName = containerName;
49
52
 
package/lib/hooks.js CHANGED
@@ -12,11 +12,12 @@
12
12
 
13
13
  var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
14
14
 
15
- var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
15
+ var loadEntryPoint = require('./relay-hooks/loadEntryPoint');
16
16
 
17
- var RelayRuntime = require('relay-runtime');
17
+ var _require = require('./relay-hooks/loadQuery'),
18
+ loadQuery = _require.loadQuery;
18
19
 
19
- var loadEntryPoint = require('./relay-hooks/loadEntryPoint');
20
+ var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
20
21
 
21
22
  var useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
22
23
 
@@ -40,8 +41,7 @@ var useSubscribeToInvalidationState = require('./relay-hooks/useSubscribeToInval
40
41
 
41
42
  var useSubscription = require('./relay-hooks/useSubscription');
42
43
 
43
- var _require = require('./relay-hooks/loadQuery'),
44
- loadQuery = _require.loadQuery;
44
+ var RelayRuntime = require('relay-runtime');
45
45
 
46
46
  /**
47
47
  * The public interface for Relay Hooks.
package/lib/index.js CHANGED
@@ -10,8 +10,6 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
14
-
15
13
  var ReactRelayContext = require('./ReactRelayContext');
16
14
 
17
15
  var ReactRelayFragmentContainer = require('./ReactRelayFragmentContainer');
@@ -24,12 +22,15 @@ var ReactRelayQueryRenderer = require('./ReactRelayQueryRenderer');
24
22
 
25
23
  var ReactRelayRefetchContainer = require('./ReactRelayRefetchContainer');
26
24
 
27
- var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
28
-
29
- var RelayRuntime = require('relay-runtime');
25
+ var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
30
26
 
31
27
  var loadEntryPoint = require('./relay-hooks/loadEntryPoint');
32
28
 
29
+ var _require = require('./relay-hooks/loadQuery'),
30
+ loadQuery = _require.loadQuery;
31
+
32
+ var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
33
+
33
34
  var useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
34
35
 
35
36
  var useFragment = require('./relay-hooks/useFragment');
@@ -52,8 +53,7 @@ var useSubscribeToInvalidationState = require('./relay-hooks/useSubscribeToInval
52
53
 
53
54
  var useSubscription = require('./relay-hooks/useSubscription');
54
55
 
55
- var _require = require('./relay-hooks/loadQuery'),
56
- loadQuery = _require.loadQuery;
56
+ var RelayRuntime = require('relay-runtime');
57
57
 
58
58
  /**
59
59
  * The public interface to react-relay.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ 'use strict';
12
+
13
+ var didWarnAboutMessageChannel = false;
14
+ var enqueueTaskImpl = null;
15
+
16
+ function enqueueTask(task) {
17
+ if (enqueueTaskImpl === null) {
18
+ 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
+ var requireString = ('require' + Math.random()).slice(0, 7);
22
+ var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
23
+ // version of setImmediate, bypassing fake timers if any.
24
+
25
+ enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
26
+ } 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
+ enqueueTaskImpl = function enqueueTaskImpl(callback) {
31
+ if (process.env.NODE_ENV !== "production") {
32
+ if (didWarnAboutMessageChannel === false) {
33
+ didWarnAboutMessageChannel = true;
34
+
35
+ if (typeof MessageChannel === 'undefined') {
36
+ 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
+ }
38
+ }
39
+ }
40
+ /*global MessageChannel*/
41
+
42
+
43
+ var channel = new MessageChannel();
44
+ channel.port1.onmessage = callback;
45
+ channel.port2.postMessage(undefined);
46
+ };
47
+ }
48
+ }
49
+
50
+ return enqueueTaskImpl(task);
51
+ }
52
+
53
+ module.exports = enqueueTask;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "act", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _internalAct.act;
10
+ }
11
+ });
12
+
13
+ var _internalAct = require("./internalAct");
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+
12
+ /* global jest */
13
+ // This file is sync'd from https://github.com/facebook/react/tree/main/packages/jest-react
14
+ // This version of `act` is only used by our tests. Unlike the public version
15
+ // of `act`, it's designed to work identically in both production and
16
+ // development. It may have slightly different behavior from the public
17
+ // version, too, since our constraints in our test suite are not the same as
18
+ // those of developers using React — we're testing React itself, as opposed to
19
+ // building an app with React.
20
+ 'use strict';
21
+
22
+ var enqueueTask = require('./enqueueTask');
23
+
24
+ var Scheduler = require('scheduler/unstable_mock'); // The subset of a Promise that React APIs rely on. This resolves a value.
25
+ // This doesn't require a return value neither from the handler nor the
26
+ // then function.
27
+
28
+
29
+ var actingUpdatesScopeDepth = 0;
30
+
31
+ function act(scope) {
32
+ if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
33
+ throw Error('This version of `act` requires a special mock build of Scheduler.');
34
+ }
35
+
36
+ if (setTimeout._isMockFunction !== true) {
37
+ throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
38
+ }
39
+
40
+ var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
41
+ actingUpdatesScopeDepth++;
42
+
43
+ var unwind = function unwind() {
44
+ actingUpdatesScopeDepth--;
45
+
46
+ if (process.env.NODE_ENV !== "production") {
47
+ if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
48
+ // if it's _less than_ previousActingUpdatesScopeDepth, then we can
49
+ // assume the 'other' one has warned
50
+ 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. ');
51
+ }
52
+ }
53
+ }; // TODO: This would be way simpler if 1) we required a promise to be
54
+ // returned and 2) we could use async/await. Since it's only our used in
55
+ // our test suite, we should be able to.
56
+
57
+
58
+ try {
59
+ var thenable = scope();
60
+
61
+ if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') {
62
+ return {
63
+ then: function then(resolve, reject) {
64
+ thenable.then(function () {
65
+ flushActWork(function () {
66
+ unwind();
67
+ resolve();
68
+ }, function (error) {
69
+ unwind();
70
+ reject(error);
71
+ });
72
+ }, function (error) {
73
+ unwind();
74
+ reject(error);
75
+ });
76
+ }
77
+ };
78
+ } else {
79
+ try {
80
+ // TODO: Let's not support non-async scopes at all in our tests. Need to
81
+ // migrate existing tests.
82
+ var didFlushWork;
83
+
84
+ do {
85
+ didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
86
+ } while (didFlushWork);
87
+ } finally {
88
+ unwind();
89
+ }
90
+ }
91
+ } catch (error) {
92
+ unwind();
93
+ throw error;
94
+ }
95
+ }
96
+
97
+ function flushActWork(resolve, reject) {
98
+ // Flush suspended fallbacks
99
+ // $FlowFixMe: Flow doesn't know about global Jest object
100
+ jest.runOnlyPendingTimers();
101
+ enqueueTask(function () {
102
+ try {
103
+ var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
104
+
105
+ if (didFlushWork) {
106
+ flushActWork(resolve, reject);
107
+ } else {
108
+ resolve();
109
+ }
110
+ } catch (error) {
111
+ reject(error);
112
+ }
113
+ });
114
+ }
115
+
116
+ exports.act = act;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ 'use strict';
12
+
13
+ var RelayEnvironmentProvider = require('../relay-hooks/RelayEnvironmentProvider');
14
+
15
+ var useRelayActorEnvironment = require('./useRelayActorEnvironment');
16
+
17
+ var React = require('react');
18
+
19
+ function ActorChange(props) {
20
+ var actorEnvironment = useRelayActorEnvironment(props.actorChangePoint.__viewer);
21
+ var getEnvironmentForActor = React.useCallback(function (actorIdentifier) {
22
+ return actorEnvironment.multiActorEnvironment.forActor(actorIdentifier);
23
+ }, [actorEnvironment]);
24
+ return /*#__PURE__*/React.createElement(RelayEnvironmentProvider, {
25
+ environment: actorEnvironment,
26
+ getEnvironmentForActor: getEnvironmentForActor
27
+ }, props.children(props.actorChangePoint.__fragmentRef, props.actorChangePoint.__viewer));
28
+ }
29
+
30
+ module.exports = ActorChange;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ 'use strict';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ // flowlint ambiguous-object-type:error
12
+ 'use strict';
13
+
14
+ var invariant = require('invariant');
15
+
16
+ var _require = require('react'),
17
+ useContext = _require.useContext;
18
+
19
+ var ReactRelayContext = require('react-relay/ReactRelayContext');
20
+
21
+ function useRelayActorEnvironment(actorIdentifier) {
22
+ var context = useContext(ReactRelayContext);
23
+ !(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
+ var getEnvironmentForActor = context.getEnvironmentForActor;
25
+ !(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;
26
+ return getEnvironmentForActor(actorIdentifier);
27
+ }
28
+
29
+ module.exports = useRelayActorEnvironment;
@@ -13,16 +13,16 @@
13
13
 
14
14
  var ProfilerContext = require('./ProfilerContext');
15
15
 
16
- var React = require('react');
17
-
18
16
  var useRelayEnvironment = require('./useRelayEnvironment');
19
17
 
20
- var warning = require("fbjs/lib/warning");
18
+ var React = require('react');
21
19
 
22
20
  var _require = require('react'),
23
21
  useContext = _require.useContext,
24
22
  useEffect = _require.useEffect;
25
23
 
24
+ var warning = require("fbjs/lib/warning");
25
+
26
26
  function EntryPointContainer(_ref) {
27
27
  var entryPointReference = _ref.entryPointReference,
28
28
  props = _ref.props;