relay-runtime 11.0.0-rc.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/handlers/connection/ConnectionHandler.js.flow +7 -0
  2. package/handlers/connection/MutationHandlers.js.flow +28 -0
  3. package/index.js +1 -1
  4. package/index.js.flow +20 -3
  5. package/lib/handlers/RelayDefaultHandlerProvider.js +1 -1
  6. package/lib/handlers/connection/ConnectionHandler.js +12 -6
  7. package/lib/handlers/connection/MutationHandlers.js +67 -8
  8. package/lib/index.js +15 -0
  9. package/lib/multi-actor-environment/ActorIdentifier.js +33 -0
  10. package/lib/multi-actor-environment/ActorSpecificEnvironment.js +148 -0
  11. package/lib/multi-actor-environment/ActorUtils.js +27 -0
  12. package/lib/multi-actor-environment/MultiActorEnvironment.js +406 -0
  13. package/lib/multi-actor-environment/MultiActorEnvironmentTypes.js +11 -0
  14. package/lib/multi-actor-environment/index.js +21 -0
  15. package/lib/mutations/RelayRecordProxy.js +1 -1
  16. package/lib/mutations/RelayRecordSourceMutator.js +1 -1
  17. package/lib/mutations/RelayRecordSourceProxy.js +1 -1
  18. package/lib/mutations/RelayRecordSourceSelectorProxy.js +7 -2
  19. package/lib/mutations/applyOptimisticMutation.js +1 -1
  20. package/lib/mutations/commitMutation.js +5 -2
  21. package/lib/mutations/validateMutation.js +39 -17
  22. package/lib/network/RelayNetwork.js +1 -1
  23. package/lib/network/RelayObservable.js +3 -1
  24. package/lib/network/RelayQueryResponseCache.js +20 -3
  25. package/lib/network/wrapNetworkWithLogObserver.js +78 -0
  26. package/lib/query/GraphQLTag.js +1 -1
  27. package/lib/query/fetchQuery.js +1 -1
  28. package/lib/query/fetchQueryInternal.js +1 -1
  29. package/lib/store/DataChecker.js +132 -50
  30. package/lib/store/{RelayModernQueryExecutor.js → OperationExecutor.js} +524 -187
  31. package/lib/store/RelayConcreteVariables.js +29 -4
  32. package/lib/store/RelayModernEnvironment.js +137 -220
  33. package/lib/store/RelayModernFragmentSpecResolver.js +49 -23
  34. package/lib/store/RelayModernRecord.js +36 -2
  35. package/lib/store/RelayModernSelector.js +1 -1
  36. package/lib/store/RelayModernStore.js +53 -22
  37. package/lib/store/RelayOperationTracker.js +34 -24
  38. package/lib/store/RelayPublishQueue.js +30 -8
  39. package/lib/store/RelayReader.js +177 -29
  40. package/lib/store/RelayRecordSource.js +87 -3
  41. package/lib/store/RelayReferenceMarker.js +53 -28
  42. package/lib/store/RelayResponseNormalizer.js +247 -108
  43. package/lib/store/RelayStoreReactFlightUtils.js +7 -11
  44. package/lib/store/RelayStoreSubscriptions.js +8 -5
  45. package/lib/store/RelayStoreUtils.js +10 -4
  46. package/lib/store/ResolverCache.js +213 -0
  47. package/lib/store/ResolverFragments.js +57 -0
  48. package/lib/store/cloneRelayHandleSourceField.js +1 -1
  49. package/lib/store/cloneRelayScalarHandleSourceField.js +1 -1
  50. package/lib/store/createRelayContext.js +2 -2
  51. package/lib/store/defaultGetDataID.js +3 -1
  52. package/lib/store/readInlineData.js +1 -1
  53. package/lib/subscription/requestSubscription.js +32 -6
  54. package/lib/util/RelayConcreteNode.js +3 -0
  55. package/lib/util/RelayFeatureFlags.js +5 -4
  56. package/lib/util/RelayProfiler.js +17 -187
  57. package/lib/util/RelayReplaySubject.js +22 -7
  58. package/lib/util/deepFreeze.js +1 -0
  59. package/lib/util/getPaginationMetadata.js +41 -0
  60. package/lib/util/getPaginationVariables.js +67 -0
  61. package/lib/util/getPendingOperationsForFragment.js +55 -0
  62. package/lib/util/getRefetchMetadata.js +36 -0
  63. package/lib/util/getRelayHandleKey.js +1 -1
  64. package/lib/util/getRequestIdentifier.js +1 -1
  65. package/lib/util/getValueAtPath.js +51 -0
  66. package/lib/util/isEmptyObject.js +1 -1
  67. package/lib/util/registerEnvironmentWithDevTools.js +26 -0
  68. package/lib/util/withDuration.js +31 -0
  69. package/multi-actor-environment/ActorIdentifier.js.flow +43 -0
  70. package/multi-actor-environment/ActorSpecificEnvironment.js.flow +217 -0
  71. package/multi-actor-environment/ActorUtils.js.flow +33 -0
  72. package/multi-actor-environment/MultiActorEnvironment.js.flow +485 -0
  73. package/multi-actor-environment/MultiActorEnvironmentTypes.js.flow +245 -0
  74. package/multi-actor-environment/index.js.flow +27 -0
  75. package/mutations/RelayRecordSourceSelectorProxy.js.flow +7 -2
  76. package/mutations/commitMutation.js.flow +3 -1
  77. package/mutations/validateMutation.js.flow +42 -16
  78. package/network/RelayNetworkTypes.js.flow +17 -8
  79. package/network/RelayObservable.js.flow +2 -0
  80. package/network/RelayQueryResponseCache.js.flow +31 -17
  81. package/network/wrapNetworkWithLogObserver.js.flow +99 -0
  82. package/package.json +3 -2
  83. package/relay-runtime.js +2 -2
  84. package/relay-runtime.min.js +2 -2
  85. package/store/ClientID.js.flow +5 -1
  86. package/store/DataChecker.js.flow +148 -44
  87. package/store/{RelayModernQueryExecutor.js.flow → OperationExecutor.js.flow} +578 -237
  88. package/store/RelayConcreteVariables.js.flow +31 -1
  89. package/store/RelayModernEnvironment.js.flow +132 -220
  90. package/store/RelayModernFragmentSpecResolver.js.flow +40 -14
  91. package/store/RelayModernOperationDescriptor.js.flow +9 -3
  92. package/store/RelayModernRecord.js.flow +49 -0
  93. package/store/RelayModernStore.js.flow +57 -17
  94. package/store/RelayOperationTracker.js.flow +56 -34
  95. package/store/RelayPublishQueue.js.flow +37 -11
  96. package/store/RelayReader.js.flow +186 -27
  97. package/store/RelayRecordSource.js.flow +72 -6
  98. package/store/RelayReferenceMarker.js.flow +51 -21
  99. package/store/RelayResponseNormalizer.js.flow +251 -67
  100. package/store/RelayStoreReactFlightUtils.js.flow +6 -9
  101. package/store/RelayStoreSubscriptions.js.flow +10 -3
  102. package/store/RelayStoreTypes.js.flow +144 -21
  103. package/store/RelayStoreUtils.js.flow +19 -4
  104. package/store/ResolverCache.js.flow +247 -0
  105. package/store/ResolverFragments.js.flow +128 -0
  106. package/store/createRelayContext.js.flow +1 -1
  107. package/store/defaultGetDataID.js.flow +3 -1
  108. package/subscription/requestSubscription.js.flow +43 -8
  109. package/util/NormalizationNode.js.flow +16 -3
  110. package/util/ReaderNode.js.flow +29 -2
  111. package/util/RelayConcreteNode.js.flow +3 -0
  112. package/util/RelayFeatureFlags.js.flow +10 -6
  113. package/util/RelayProfiler.js.flow +22 -194
  114. package/util/RelayReplaySubject.js.flow +7 -6
  115. package/util/RelayRuntimeTypes.js.flow +4 -2
  116. package/util/deepFreeze.js.flow +2 -1
  117. package/util/getPaginationMetadata.js.flow +74 -0
  118. package/util/getPaginationVariables.js.flow +112 -0
  119. package/util/getPendingOperationsForFragment.js.flow +62 -0
  120. package/util/getRefetchMetadata.js.flow +80 -0
  121. package/util/getValueAtPath.js.flow +46 -0
  122. package/util/isEmptyObject.js.flow +2 -1
  123. package/util/registerEnvironmentWithDevTools.js.flow +33 -0
  124. package/util/withDuration.js.flow +32 -0
  125. package/lib/store/RelayRecordSourceMapImpl.js +0 -107
  126. package/lib/store/RelayStoreSubscriptionsUsingMapByID.js +0 -318
  127. package/store/RelayRecordSourceMapImpl.js.flow +0 -91
  128. package/store/RelayStoreSubscriptionsUsingMapByID.js.flow +0 -283
@@ -332,13 +332,15 @@ var RelayObservable = /*#__PURE__*/function () {
332
332
  if (subscriptions.length === 0) {
333
333
  sink.complete();
334
334
  }
335
- }
335
+ } // $FlowFixMe[incompatible-call]
336
+
336
337
 
337
338
  _this7.subscribe({
338
339
  start: start,
339
340
  next: function next(value) {
340
341
  try {
341
342
  if (!sink.closed) {
343
+ // $FlowFixMe[incompatible-call]
342
344
  RelayObservable.from(fn(value)).subscribe({
343
345
  start: start,
344
346
  next: sink.next,
@@ -14,7 +14,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
14
14
 
15
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
16
 
17
- var invariant = require("fbjs/lib/invariant");
17
+ var invariant = require('invariant');
18
18
 
19
19
  var stableCopy = require('../util/stableCopy');
20
20
 
@@ -53,11 +53,28 @@ var RelayQueryResponseCache = /*#__PURE__*/function () {
53
53
 
54
54
  var response = this._responses.get(cacheKey);
55
55
 
56
- return response != null ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, response.payload), {}, {
56
+ if (response == null) {
57
+ return null;
58
+ }
59
+
60
+ if (Array.isArray(response.payload)) {
61
+ return response.payload.map(function (payload) {
62
+ return (// $FlowFixMe[incompatible-cast]
63
+ (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, payload), {}, {
64
+ extensions: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, payload.extensions), {}, {
65
+ cacheTimestamp: response.fetchTime
66
+ })
67
+ })
68
+ );
69
+ });
70
+ } // $FlowFixMe[incompatible-cast]
71
+
72
+
73
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, response.payload), {}, {
57
74
  extensions: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, response.payload.extensions), {}, {
58
75
  cacheTimestamp: response.fetchTime
59
76
  })
60
- }) : null;
77
+ });
61
78
  };
62
79
 
63
80
  _proto.set = function set(queryID, variables, payload) {
@@ -0,0 +1,78 @@
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
+ * @format
9
+ */
10
+ // flowlint ambiguous-object-type:error
11
+ 'use strict';
12
+
13
+ var generateID = require('../util/generateID');
14
+
15
+ /**
16
+ * Wraps the network with logging to ensure that network requests are
17
+ * always logged. Relying on each network callsite to be wrapped is
18
+ * untenable and will eventually lead to holes in the logging.
19
+ * NOTE: This function takes an environment instance, because Relay
20
+ * devtools will mutate the `env.__log` method, and the devtools rely
21
+ * on it to receive network events.
22
+ */
23
+ function wrapNetworkWithLogObserver(env, network) {
24
+ return {
25
+ execute: function execute(params, variables, cacheConfig, uploadables) {
26
+ var networkRequestId = generateID();
27
+ var logObserver = {
28
+ start: function start(subscription) {
29
+ env.__log({
30
+ name: 'network.start',
31
+ networkRequestId: networkRequestId,
32
+ params: params,
33
+ variables: variables,
34
+ cacheConfig: cacheConfig
35
+ });
36
+ },
37
+ next: function next(response) {
38
+ env.__log({
39
+ name: 'network.next',
40
+ networkRequestId: networkRequestId,
41
+ response: response
42
+ });
43
+ },
44
+ error: function error(_error) {
45
+ env.__log({
46
+ name: 'network.error',
47
+ networkRequestId: networkRequestId,
48
+ error: _error
49
+ });
50
+ },
51
+ complete: function complete() {
52
+ env.__log({
53
+ name: 'network.complete',
54
+ networkRequestId: networkRequestId
55
+ });
56
+ },
57
+ unsubscribe: function unsubscribe() {
58
+ env.__log({
59
+ name: 'network.unsubscribe',
60
+ networkRequestId: networkRequestId
61
+ });
62
+ }
63
+ };
64
+
65
+ var logRequestInfo = function logRequestInfo(info) {
66
+ env.__log({
67
+ name: 'network.info',
68
+ networkRequestId: networkRequestId,
69
+ info: info
70
+ });
71
+ };
72
+
73
+ return network.execute(params, variables, cacheConfig, uploadables, logRequestInfo)["do"](logObserver);
74
+ }
75
+ };
76
+ }
77
+
78
+ module.exports = wrapNetworkWithLogObserver;
@@ -12,7 +12,7 @@
12
12
 
13
13
  var RelayConcreteNode = require('../util/RelayConcreteNode');
14
14
 
15
- var invariant = require("fbjs/lib/invariant");
15
+ var invariant = require('invariant');
16
16
 
17
17
  var warning = require("fbjs/lib/warning");
18
18
 
@@ -19,7 +19,7 @@ var RelayObservable = require('../network/RelayObservable');
19
19
 
20
20
  var fetchQueryInternal = require('./fetchQueryInternal');
21
21
 
22
- var invariant = require("fbjs/lib/invariant");
22
+ var invariant = require('invariant');
23
23
 
24
24
  var reportMissingRequiredFields = require('../util/reportMissingRequiredFields');
25
25
 
@@ -14,7 +14,7 @@ var Observable = require('../network/RelayObservable');
14
14
 
15
15
  var RelayReplaySubject = require('../util/RelayReplaySubject');
16
16
 
17
- var invariant = require("fbjs/lib/invariant");
17
+ var invariant = require('invariant');
18
18
 
19
19
  var WEAKMAP_SUPPORTED = typeof WeakMap === 'function';
20
20
  var requestCachesByEnvironment = WEAKMAP_SUPPORTED ? new WeakMap() : new Map();
@@ -35,19 +35,24 @@ var cloneRelayScalarHandleSourceField = require('./cloneRelayScalarHandleSourceF
35
35
 
36
36
  var getOperation = require('../util/getOperation');
37
37
 
38
- var invariant = require("fbjs/lib/invariant");
38
+ var invariant = require('invariant');
39
39
 
40
40
  var _require = require('./ClientID'),
41
41
  isClientID = _require.isClientID;
42
42
 
43
- var _require2 = require('./RelayRecordState'),
44
- EXISTENT = _require2.EXISTENT,
45
- UNKNOWN = _require2.UNKNOWN;
43
+ var _require2 = require('./RelayConcreteVariables'),
44
+ getLocalVariables = _require2.getLocalVariables;
46
45
 
47
- var _require3 = require('./TypeID'),
48
- generateTypeID = _require3.generateTypeID;
46
+ var _require3 = require('./RelayRecordState'),
47
+ EXISTENT = _require3.EXISTENT,
48
+ UNKNOWN = _require3.UNKNOWN;
49
49
 
50
- var CONDITION = RelayConcreteNode.CONDITION,
50
+ var _require4 = require('./TypeID'),
51
+ generateTypeID = _require4.generateTypeID;
52
+
53
+ var ACTOR_CHANGE = RelayConcreteNode.ACTOR_CHANGE,
54
+ CONDITION = RelayConcreteNode.CONDITION,
55
+ CLIENT_COMPONENT = RelayConcreteNode.CLIENT_COMPONENT,
51
56
  CLIENT_EXTENSION = RelayConcreteNode.CLIENT_EXTENSION,
52
57
  DEFER = RelayConcreteNode.DEFER,
53
58
  FLIGHT_FIELD = RelayConcreteNode.FLIGHT_FIELD,
@@ -75,11 +80,11 @@ var ROOT_ID = RelayStoreUtils.ROOT_ID,
75
80
  * If all records are present, returns `true`, otherwise `false`.
76
81
  */
77
82
 
78
- function check(source, target, selector, handlers, operationLoader, getDataID) {
83
+ function check(getSourceForActor, getTargetForActor, defaultActorIdentifier, selector, handlers, operationLoader, getDataID, shouldProcessClientComponents) {
79
84
  var dataID = selector.dataID,
80
85
  node = selector.node,
81
86
  variables = selector.variables;
82
- var checker = new DataChecker(source, target, variables, handlers, operationLoader, getDataID);
87
+ var checker = new DataChecker(getSourceForActor, getTargetForActor, defaultActorIdentifier, variables, handlers, operationLoader, getDataID, shouldProcessClientComponents);
83
88
  return checker.check(node, dataID);
84
89
  }
85
90
  /**
@@ -88,20 +93,45 @@ function check(source, target, selector, handlers, operationLoader, getDataID) {
88
93
 
89
94
 
90
95
  var DataChecker = /*#__PURE__*/function () {
91
- function DataChecker(source, target, variables, handlers, operationLoader, getDataID) {
92
- var mutator = new RelayRecordSourceMutator(source, target);
96
+ function DataChecker(getSourceForActor, getTargetForActor, defaultActorIdentifier, variables, handlers, operationLoader, getDataID, shouldProcessClientComponents) {
97
+ this._getSourceForActor = getSourceForActor;
98
+ this._getTargetForActor = getTargetForActor;
99
+ this._getDataID = getDataID;
100
+ this._source = getSourceForActor(defaultActorIdentifier);
101
+ this._mutatorRecordSourceProxyCache = new Map();
102
+
103
+ var _this$_getMutatorAndR = this._getMutatorAndRecordProxyForActor(defaultActorIdentifier),
104
+ mutator = _this$_getMutatorAndR[0],
105
+ recordSourceProxy = _this$_getMutatorAndR[1];
106
+
93
107
  this._mostRecentlyInvalidatedAt = null;
94
108
  this._handlers = handlers;
95
109
  this._mutator = mutator;
96
110
  this._operationLoader = operationLoader !== null && operationLoader !== void 0 ? operationLoader : null;
97
- this._recordSourceProxy = new RelayRecordSourceProxy(mutator, getDataID);
111
+ this._recordSourceProxy = recordSourceProxy;
98
112
  this._recordWasMissing = false;
99
- this._source = source;
100
113
  this._variables = variables;
114
+ this._shouldProcessClientComponents = shouldProcessClientComponents;
101
115
  }
102
116
 
103
117
  var _proto = DataChecker.prototype;
104
118
 
119
+ _proto._getMutatorAndRecordProxyForActor = function _getMutatorAndRecordProxyForActor(actorIdentifier) {
120
+ var tuple = this._mutatorRecordSourceProxyCache.get(actorIdentifier);
121
+
122
+ if (tuple == null) {
123
+ var target = this._getTargetForActor(actorIdentifier);
124
+
125
+ var mutator = new RelayRecordSourceMutator(this._getSourceForActor(actorIdentifier), target);
126
+ var recordSourceProxy = new RelayRecordSourceProxy(mutator, this._getDataID);
127
+ tuple = [mutator, recordSourceProxy];
128
+
129
+ this._mutatorRecordSourceProxyCache.set(actorIdentifier, tuple);
130
+ }
131
+
132
+ return tuple;
133
+ };
134
+
105
135
  _proto.check = function check(node, dataID) {
106
136
  this._traverse(node, dataID);
107
137
 
@@ -115,7 +145,8 @@ var DataChecker = /*#__PURE__*/function () {
115
145
  };
116
146
 
117
147
  _proto._getVariableValue = function _getVariableValue(name) {
118
- !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayAsyncLoader(): Undefined variable `%s`.', name) : invariant(false) : void 0;
148
+ !this._variables.hasOwnProperty(name) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayAsyncLoader(): Undefined variable `%s`.', name) : invariant(false) : void 0; // $FlowFixMe[cannot-write]
149
+
119
150
  return this._variables[name];
120
151
  };
121
152
 
@@ -125,6 +156,8 @@ var DataChecker = /*#__PURE__*/function () {
125
156
 
126
157
  _proto._getDataForHandlers = function _getDataForHandlers(field, dataID) {
127
158
  return {
159
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
160
+ * this parameters */
128
161
  args: field.args ? getArgumentValues(field.args, this._variables) : {},
129
162
  // Getting a snapshot of the record state is potentially expensive since
130
163
  // we will need to merge the sink and source records. Since we do not create
@@ -276,8 +309,13 @@ var DataChecker = /*#__PURE__*/function () {
276
309
 
277
310
  break;
278
311
 
312
+ case ACTOR_CHANGE:
313
+ _this2._checkActorChange(selection.linkedField, dataID);
314
+
315
+ break;
316
+
279
317
  case CONDITION:
280
- var conditionValue = _this2._getVariableValue(selection.condition);
318
+ var conditionValue = Boolean(_this2._getVariableValue(selection.condition));
281
319
 
282
320
  if (conditionValue === selection.passingValue) {
283
321
  _this2._traverseSelections(selection.selections, dataID);
@@ -287,16 +325,16 @@ var DataChecker = /*#__PURE__*/function () {
287
325
 
288
326
  case INLINE_FRAGMENT:
289
327
  {
290
- var abstractKey = selection.abstractKey;
328
+ var _abstractKey = selection.abstractKey;
291
329
 
292
- if (abstractKey == null) {
330
+ if (_abstractKey == null) {
293
331
  // concrete type refinement: only check data if the type exactly matches
294
332
  var typeName = _this2._mutator.getType(dataID);
295
333
 
296
334
  if (typeName === selection.type) {
297
335
  _this2._traverseSelections(selection.selections, dataID);
298
336
  }
299
- } else if (RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT) {
337
+ } else {
300
338
  // Abstract refinement: check data depending on whether the type
301
339
  // conforms to the interface/union or not:
302
340
  // - Type known to _not_ implement the interface: don't check the selections.
@@ -304,25 +342,22 @@ var DataChecker = /*#__PURE__*/function () {
304
342
  // - Unknown whether the type implements the interface: don't check the selections
305
343
  // and treat the data as missing; we do this because the Relay Compiler
306
344
  // guarantees that the type discriminator will always be fetched.
307
- var recordType = _this2._mutator.getType(dataID);
345
+ var _recordType = _this2._mutator.getType(dataID);
346
+
347
+ !(_recordType != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected record `%s` to have a known type', dataID) : invariant(false) : void 0;
308
348
 
309
- !(recordType != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected record `%s` to have a known type', dataID) : invariant(false) : void 0;
310
- var typeID = generateTypeID(recordType);
349
+ var _typeID = generateTypeID(_recordType);
311
350
 
312
- var implementsInterface = _this2._mutator.getValue(typeID, abstractKey);
351
+ var _implementsInterface = _this2._mutator.getValue(_typeID, _abstractKey);
313
352
 
314
- if (implementsInterface === true) {
353
+ if (_implementsInterface === true) {
315
354
  _this2._traverseSelections(selection.selections, dataID);
316
- } else if (implementsInterface == null) {
355
+ } else if (_implementsInterface == null) {
317
356
  // unsure if the type implements the interface: data is
318
357
  // missing so don't bother reading the fragment
319
358
  _this2._handleMissing();
320
359
  } // else false: known to not implement the interface
321
360
 
322
- } else {
323
- // legacy behavior for abstract refinements: always check even
324
- // if the type doesn't conform
325
- _this2._traverseSelections(selection.selections, dataID);
326
361
  }
327
362
 
328
363
  break;
@@ -362,11 +397,14 @@ var DataChecker = /*#__PURE__*/function () {
362
397
  _this2._traverseSelections(selection.selections, dataID);
363
398
 
364
399
  break;
365
- // $FlowFixMe[incompatible-type]
366
400
 
367
401
  case FRAGMENT_SPREAD:
402
+ var prevVariables = _this2._variables;
403
+ _this2._variables = getLocalVariables(_this2._variables, selection.fragment.argumentDefinitions, selection.args);
404
+
368
405
  _this2._traverseSelections(selection.fragment.selections, dataID);
369
406
 
407
+ _this2._variables = prevVariables;
370
408
  break;
371
409
 
372
410
  case CLIENT_EXTENSION:
@@ -378,24 +416,21 @@ var DataChecker = /*#__PURE__*/function () {
378
416
  break;
379
417
 
380
418
  case TYPE_DISCRIMINATOR:
381
- if (RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT) {
382
- var _abstractKey = selection.abstractKey;
419
+ var abstractKey = selection.abstractKey;
383
420
 
384
- var _recordType = _this2._mutator.getType(dataID);
421
+ var recordType = _this2._mutator.getType(dataID);
385
422
 
386
- !(_recordType != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected record `%s` to have a known type', dataID) : invariant(false) : void 0;
423
+ !(recordType != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected record `%s` to have a known type', dataID) : invariant(false) : void 0;
424
+ var typeID = generateTypeID(recordType);
387
425
 
388
- var _typeID = generateTypeID(_recordType);
426
+ var implementsInterface = _this2._mutator.getValue(typeID, abstractKey);
389
427
 
390
- var _implementsInterface = _this2._mutator.getValue(_typeID, _abstractKey);
428
+ if (implementsInterface == null) {
429
+ // unsure if the type implements the interface: data is
430
+ // missing
431
+ _this2._handleMissing();
432
+ } // else: if it does or doesn't implement, we don't need to check or skip anything else
391
433
 
392
- if (_implementsInterface == null) {
393
- // unsure if the type implements the interface: data is
394
- // missing
395
- _this2._handleMissing();
396
- } // else: if it does or doesn't implement, we don't need to check or skip anything else
397
-
398
- }
399
434
 
400
435
  break;
401
436
 
@@ -408,6 +443,15 @@ var DataChecker = /*#__PURE__*/function () {
408
443
 
409
444
  break;
410
445
 
446
+ case CLIENT_COMPONENT:
447
+ if (_this2._shouldProcessClientComponents === false) {
448
+ break;
449
+ }
450
+
451
+ _this2._traverseSelections(selection.fragment.selections, dataID);
452
+
453
+ break;
454
+
411
455
  default:
412
456
  selection;
413
457
  !false ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayAsyncLoader(): Unexpected ast kind `%s`.', selection.kind) : invariant(false) : void 0;
@@ -434,8 +478,12 @@ var DataChecker = /*#__PURE__*/function () {
434
478
 
435
479
  if (normalizationRootNode != null) {
436
480
  var operation = getOperation(normalizationRootNode);
481
+ var prevVariables = this._variables;
482
+ this._variables = getLocalVariables(this._variables, operation.argumentDefinitions, moduleImport.args);
437
483
 
438
484
  this._traverse(operation, dataID);
485
+
486
+ this._variables = prevVariables;
439
487
  } else {
440
488
  // If the fragment is not available, we assume that the data cannot have been
441
489
  // processed yet and must therefore be missing.
@@ -503,6 +551,40 @@ var DataChecker = /*#__PURE__*/function () {
503
551
  }
504
552
  };
505
553
 
554
+ _proto._checkActorChange = function _checkActorChange(field, dataID) {
555
+ var storageKey = getStorageKey(field, this._variables);
556
+
557
+ var record = this._source.get(dataID);
558
+
559
+ var tuple = record != null ? RelayModernRecord.getActorLinkedRecordID(record, storageKey) : record;
560
+
561
+ if (tuple == null) {
562
+ if (tuple === undefined) {
563
+ this._handleMissing();
564
+ }
565
+ } else {
566
+ var _actorIdentifier = tuple[0],
567
+ linkedID = tuple[1];
568
+ var prevSource = this._source;
569
+ var prevMutator = this._mutator;
570
+ var prevRecordSourceProxy = this._recordSourceProxy;
571
+
572
+ var _this$_getMutatorAndR2 = this._getMutatorAndRecordProxyForActor(_actorIdentifier),
573
+ mutator = _this$_getMutatorAndR2[0],
574
+ recordSourceProxy = _this$_getMutatorAndR2[1];
575
+
576
+ this._source = this._getSourceForActor(_actorIdentifier);
577
+ this._mutator = mutator;
578
+ this._recordSourceProxy = recordSourceProxy;
579
+
580
+ this._traverse(field, linkedID);
581
+
582
+ this._source = prevSource;
583
+ this._mutator = prevMutator;
584
+ this._recordSourceProxy = prevRecordSourceProxy;
585
+ }
586
+ };
587
+
506
588
  _proto._checkFlightField = function _checkFlightField(field, dataID) {
507
589
  var storageKey = getStorageKey(field, this._variables);
508
590
 
@@ -520,28 +602,28 @@ var DataChecker = /*#__PURE__*/function () {
520
602
 
521
603
  var tree = this._mutator.getValue(linkedID, RelayStoreReactFlightUtils.REACT_FLIGHT_TREE_STORAGE_KEY);
522
604
 
523
- var reachableQueries = this._mutator.getValue(linkedID, RelayStoreReactFlightUtils.REACT_FLIGHT_QUERIES_STORAGE_KEY);
605
+ var reachableExecutableDefinitions = this._mutator.getValue(linkedID, RelayStoreReactFlightUtils.REACT_FLIGHT_EXECUTABLE_DEFINITIONS_STORAGE_KEY);
524
606
 
525
- if (tree == null || !Array.isArray(reachableQueries)) {
607
+ if (tree == null || !Array.isArray(reachableExecutableDefinitions)) {
526
608
  this._handleMissing();
527
609
 
528
610
  return;
529
611
  }
530
612
 
531
613
  var operationLoader = this._operationLoader;
532
- !(operationLoader !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected an operationLoader to be configured when using ' + 'React Flight.') : invariant(false) : void 0; // In Flight, the variables that are in scope for reachable queries aren't
533
- // the same as what's in scope for the outer query.
614
+ !(operationLoader !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DataChecker: Expected an operationLoader to be configured when using ' + 'React Flight.') : invariant(false) : void 0; // In Flight, the variables that are in scope for reachable executable
615
+ // definitions aren't the same as what's in scope for the outer query.
534
616
 
535
617
  var prevVariables = this._variables; // $FlowFixMe[incompatible-cast]
536
618
 
537
- var _iterator4 = (0, _createForOfIteratorHelper2["default"])(reachableQueries),
619
+ var _iterator4 = (0, _createForOfIteratorHelper2["default"])(reachableExecutableDefinitions),
538
620
  _step4;
539
621
 
540
622
  try {
541
623
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
542
- var query = _step4.value;
543
- this._variables = query.variables;
544
- var normalizationRootNode = operationLoader.get(query.module);
624
+ var definition = _step4.value;
625
+ this._variables = definition.variables;
626
+ var normalizationRootNode = operationLoader.get(definition.module);
545
627
 
546
628
  if (normalizationRootNode != null) {
547
629
  var operation = getOperation(normalizationRootNode);