relay-runtime 13.0.1 → 13.0.2

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.
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Relay Runtime
2
- ---
1
+ ## Relay Runtime
3
2
 
4
3
  A set of Relay APIs responsible for data fetching, reading and normalization of
5
4
  the GraphQL data.
@@ -7,7 +6,6 @@ the GraphQL data.
7
6
  Example:
8
7
 
9
8
  ```js
10
-
11
9
  // @flow strict-local
12
10
 
13
11
  import type {FetchFunction} from 'relay-runtime';
@@ -61,7 +59,6 @@ fetchQuery(
61
59
  console.log(data);
62
60
  },
63
61
  });
64
-
65
62
  ```
66
63
 
67
64
  For complete API reference, visit https://relay.dev/.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v13.0.1
2
+ * Relay v13.0.2
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -21,7 +21,7 @@ var _require = require('../query/GraphQLTag'),
21
21
  var _require2 = require('../store/RelayStoreUtils'),
22
22
  getArgumentValues = _require2.getArgumentValues;
23
23
 
24
- var nonUpdatableKeys = ['id', '__id', '__typename'];
24
+ var nonUpdatableKeys = ['id', '__id', '__typename', 'js'];
25
25
 
26
26
  function readUpdatableQuery_EXPERIMENTAL(query, variables, proxy) {
27
27
  // TODO assert that the concrete request is an updatable query
@@ -163,7 +163,7 @@ function createSetterForSingularLinkedField(selection, queryVariables, recordPro
163
163
 
164
164
  if (newValue == null) {
165
165
  // $FlowFixMe[unclear-type] No good way to type these variables
166
- recordProxy.setValue(null, selection.name, variables);
166
+ recordProxy.setValue(newValue, selection.name, variables);
167
167
  } else {
168
168
  var __id = newValue.__id;
169
169
 
@@ -27,7 +27,7 @@ function create(fetchFn, subscribe) {
27
27
  var observeFetch = convertFetch(fetchFn);
28
28
 
29
29
  function execute(request, variables, cacheConfig, uploadables, logRequestInfo) {
30
- var operationVariables = withProvidedVariables(variables, request);
30
+ var operationVariables = withProvidedVariables(variables, request.providedVariables);
31
31
 
32
32
  if (request.operationKind === 'subscription') {
33
33
  !subscribe ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayNetwork: This network layer does not support Subscriptions. ' + 'To use Subscriptions, provide a custom network layer.') : invariant(false) : void 0;
@@ -76,7 +76,7 @@ function getFragmentVariables(fragment, rootVariables, argumentVariables) {
76
76
  */
77
77
 
78
78
 
79
- function getOperationVariables(operation, parameters, variables) {
79
+ function getOperationVariables(operation, providedVariables, variables) {
80
80
  var operationVariables = {};
81
81
  operation.argumentDefinitions.forEach(function (def) {
82
82
  var value = def.defaultValue;
@@ -87,7 +87,6 @@ function getOperationVariables(operation, parameters, variables) {
87
87
 
88
88
  operationVariables[def.name] = value;
89
89
  });
90
- var providedVariables = parameters.providedVariables;
91
90
 
92
91
  if (providedVariables != null) {
93
92
  Object.keys(providedVariables).forEach(function (varName) {
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.normalizeResponse = normalizeResponse;
9
+ exports.normalizeResponseWithMetadata = normalizeResponseWithMetadata;
10
+ exports.GraphModeNormalizer = void 0;
9
11
 
10
12
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
11
13
 
@@ -30,7 +32,9 @@ var _require = require('../util/RelayConcreteNode'),
30
32
  FRAGMENT_SPREAD = _require.FRAGMENT_SPREAD,
31
33
  INLINE_FRAGMENT = _require.INLINE_FRAGMENT,
32
34
  LINKED_FIELD = _require.LINKED_FIELD,
33
- SCALAR_FIELD = _require.SCALAR_FIELD;
35
+ LINKED_HANDLE = _require.LINKED_HANDLE,
36
+ SCALAR_FIELD = _require.SCALAR_FIELD,
37
+ SCALAR_HANDLE = _require.SCALAR_HANDLE;
34
38
 
35
39
  var _require2 = require('./RelayConcreteVariables'),
36
40
  getLocalVariables = _require2.getLocalVariables;
@@ -96,6 +100,17 @@ function normalizeResponse(response, selector, options) {
96
100
  return normalizer.normalizeResponse(node, dataID, response);
97
101
  }
98
102
 
103
+ function normalizeResponseWithMetadata(response, selector, options) {
104
+ var node = selector.node,
105
+ variables = selector.variables,
106
+ dataID = selector.dataID;
107
+ var normalizer = new GraphModeNormalizer(variables, options);
108
+ var chunks = Array.from(normalizer.normalizeResponse(node, dataID, response));
109
+ return [chunks, {
110
+ duplicateFieldsAvoided: normalizer.duplicateFieldsAvoided
111
+ }];
112
+ }
113
+
99
114
  var GraphModeNormalizer = /*#__PURE__*/function () {
100
115
  function GraphModeNormalizer(variables, options) {
101
116
  this._actorIdentifier = options.actorIdentifier;
@@ -105,6 +120,7 @@ var GraphModeNormalizer = /*#__PURE__*/function () {
105
120
  this._sentFields = new Map();
106
121
  this._nextStreamID = 0;
107
122
  this._variables = variables;
123
+ this.duplicateFieldsAvoided = 0;
108
124
  }
109
125
 
110
126
  var _proto = GraphModeNormalizer.prototype;
@@ -218,6 +234,7 @@ var GraphModeNormalizer = /*#__PURE__*/function () {
218
234
 
219
235
 
220
236
  if (sentFields.has(storageKey)) {
237
+ this.duplicateFieldsAvoided++;
221
238
  break;
222
239
  }
223
240
 
@@ -237,6 +254,7 @@ var GraphModeNormalizer = /*#__PURE__*/function () {
237
254
 
238
255
 
239
256
  if (sentFields.has(_storageKey)) {
257
+ this.duplicateFieldsAvoided++;
240
258
  break;
241
259
  }
242
260
 
@@ -310,6 +328,18 @@ var GraphModeNormalizer = /*#__PURE__*/function () {
310
328
  // over client extensions.
311
329
  break;
312
330
 
331
+ case SCALAR_HANDLE:
332
+ case LINKED_HANDLE:
333
+ // Handles allow us to record information that will be needed to
334
+ // perform additional process when we insert data into the store. For
335
+ // example, connection edges need to be prepended/appended to the
336
+ // pre-existing values.
337
+ //
338
+ // GraphMode will eventually need some replacement for this, but it is
339
+ // not nessesary in order to measure things like response size, so we
340
+ // can ignore these for now.
341
+ break;
342
+
313
343
  default:
314
344
  throw new Error("Unexpected selection type: ".concat(selection.kind));
315
345
  }
@@ -388,4 +418,6 @@ var GraphModeNormalizer = /*#__PURE__*/function () {
388
418
  };
389
419
 
390
420
  return GraphModeNormalizer;
391
- }();
421
+ }();
422
+
423
+ exports.GraphModeNormalizer = GraphModeNormalizer;
@@ -34,7 +34,7 @@ var _require3 = require('./RelayStoreUtils'),
34
34
  function createOperationDescriptor(request, variables, cacheConfig) {
35
35
  var dataID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ROOT_ID;
36
36
  var operation = request.operation;
37
- var operationVariables = getOperationVariables(operation, request.params, variables);
37
+ var operationVariables = getOperationVariables(operation, request.params.providedVariables, variables);
38
38
  var requestDescriptor = createRequestDescriptor(request, operationVariables, cacheConfig);
39
39
  var operationDescriptor = {
40
40
  fragment: createReaderSelector(request.fragment, dataID, operationVariables, requestDescriptor),
@@ -10,7 +10,7 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var _global$ErrorUtils$ap, _global, _global$ErrorUtils;
13
+ var _global$ErrorUtils$ap, _global$ErrorUtils;
14
14
 
15
15
  var RelayRecordSourceMutator = require('../mutations/RelayRecordSourceMutator');
16
16
 
@@ -26,7 +26,9 @@ var invariant = require('invariant');
26
26
 
27
27
  var warning = require("fbjs/lib/warning");
28
28
 
29
- var applyWithGuard = (_global$ErrorUtils$ap = (_global = global) === null || _global === void 0 ? void 0 : (_global$ErrorUtils = _global.ErrorUtils) === null || _global$ErrorUtils === void 0 ? void 0 : _global$ErrorUtils.applyWithGuard) !== null && _global$ErrorUtils$ap !== void 0 ? _global$ErrorUtils$ap : function (callback, context, args, onError, name) {
29
+ var _global = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : undefined;
30
+
31
+ var applyWithGuard = (_global$ErrorUtils$ap = _global === null || _global === void 0 ? void 0 : (_global$ErrorUtils = _global.ErrorUtils) === null || _global$ErrorUtils === void 0 ? void 0 : _global$ErrorUtils.applyWithGuard) !== null && _global$ErrorUtils$ap !== void 0 ? _global$ErrorUtils$ap : function (callback, context, args, onError, name) {
30
32
  return callback.apply(context, args);
31
33
  };
32
34
  /**
@@ -90,6 +90,7 @@ var RelayReader = /*#__PURE__*/function () {
90
90
  this._selector = selector;
91
91
  this._variables = selector.variables;
92
92
  this._resolverCache = resolverCache;
93
+ this._fragmentName = selector.node.name;
93
94
  }
94
95
 
95
96
  var _proto = RelayReader.prototype;
@@ -219,7 +220,7 @@ var RelayReader = /*#__PURE__*/function () {
219
220
  return;
220
221
  }
221
222
 
222
- var owner = this._selector.node.name;
223
+ var owner = this._fragmentName;
223
224
 
224
225
  switch (action) {
225
226
  case 'THROW':
@@ -236,15 +237,21 @@ var RelayReader = /*#__PURE__*/function () {
236
237
  if (this._missingRequiredFields == null) {
237
238
  this._missingRequiredFields = {
238
239
  action: action,
239
- fields: []
240
+ fields: [{
241
+ path: fieldPath,
242
+ owner: owner
243
+ }]
244
+ };
245
+ } else {
246
+ this._missingRequiredFields = {
247
+ action: action,
248
+ fields: [].concat((0, _toConsumableArray2["default"])(this._missingRequiredFields.fields), [{
249
+ path: fieldPath,
250
+ owner: owner
251
+ }])
240
252
  };
241
253
  }
242
254
 
243
- this._missingRequiredFields.fields.push({
244
- path: fieldPath,
245
- owner: owner
246
- });
247
-
248
255
  return;
249
256
 
250
257
  default:
@@ -466,9 +473,7 @@ var RelayReader = /*#__PURE__*/function () {
466
473
  throw new Error('Relay Resolver fields are not yet supported.');
467
474
  }
468
475
 
469
- this._readResolverField(selection.field, record, data);
470
-
471
- break;
476
+ return this._readResolverField(selection.field, record, data);
472
477
 
473
478
  default:
474
479
  selection.field.kind;
@@ -490,6 +495,8 @@ var RelayReader = /*#__PURE__*/function () {
490
495
 
491
496
  var fragmentValue;
492
497
  var fragmentReaderSelector;
498
+ var fragmentMissingRequiredFields;
499
+ var previousMissingRequriedFields;
493
500
  var fragmentSeenRecordIDs = new Set();
494
501
 
495
502
  var getDataForResolverFragment = function getDataForResolverFragment(singularReaderSelector) {
@@ -508,14 +515,18 @@ var RelayReader = /*#__PURE__*/function () {
508
515
 
509
516
  _this._seenRecords = fragmentSeenRecordIDs;
510
517
  var resolverFragmentData = {};
518
+ previousMissingRequriedFields = _this._missingRequiredFields;
519
+ _this._missingRequiredFields = null;
511
520
 
512
521
  _this._createInlineDataOrResolverFragmentPointer(singularReaderSelector.node, record, resolverFragmentData);
513
522
 
523
+ fragmentMissingRequiredFields = _this._missingRequiredFields;
514
524
  fragmentValue = (_resolverFragmentData = resolverFragmentData[FRAGMENTS_KEY]) === null || _resolverFragmentData === void 0 ? void 0 : _resolverFragmentData[fragment.name];
515
525
  !(typeof fragmentValue === 'object' && fragmentValue !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected reader data to contain a __fragments property with a property for the fragment named ".concat(fragment.name, ", but it is missing.")) : invariant(false) : void 0;
516
526
  return fragmentValue;
517
527
  } finally {
518
528
  _this._seenRecords = existingSeenRecords;
529
+ _this._missingRequiredFields = previousMissingRequriedFields;
519
530
  }
520
531
  };
521
532
 
@@ -537,12 +548,18 @@ var RelayReader = /*#__PURE__*/function () {
537
548
  fragmentValue: fragmentValue,
538
549
  resolverID: resolverID,
539
550
  seenRecordIDs: fragmentSeenRecordIDs,
540
- readerSelector: fragmentReaderSelector
551
+ readerSelector: fragmentReaderSelector,
552
+ missingRequiredFields: fragmentMissingRequiredFields
541
553
  };
542
554
  });
543
555
  }, getDataForResolverFragment),
544
556
  result = _this$_resolverCache$[0],
545
- seenRecord = _this$_resolverCache$[1];
557
+ seenRecord = _this$_resolverCache$[1],
558
+ missingRequiredFields = _this$_resolverCache$[2];
559
+
560
+ if (missingRequiredFields != null) {
561
+ this._addMissingRequiredFields(missingRequiredFields);
562
+ }
546
563
 
547
564
  if (seenRecord != null) {
548
565
  this._seenRecords.add(seenRecord);
@@ -550,6 +567,7 @@ var RelayReader = /*#__PURE__*/function () {
550
567
 
551
568
  var applicationName = (_field$alias = field.alias) !== null && _field$alias !== void 0 ? _field$alias : field.name;
552
569
  data[applicationName] = result;
570
+ return result;
553
571
  };
554
572
 
555
573
  _proto._readClientEdge = function _readClientEdge(field, record, data) {
@@ -816,13 +834,37 @@ var RelayReader = /*#__PURE__*/function () {
816
834
  }
817
835
 
818
836
  var inlineData = {};
837
+ var parentFragmentName = this._fragmentName;
838
+ this._fragmentName = fragmentSpreadOrFragment.name;
819
839
 
820
- this._traverseSelections(fragmentSpreadOrFragment.selections, record, inlineData); // $FlowFixMe[cannot-write] - writing into read-only field
840
+ this._traverseSelections(fragmentSpreadOrFragment.selections, record, inlineData);
821
841
 
842
+ this._fragmentName = parentFragmentName; // $FlowFixMe[cannot-write] - writing into read-only field
822
843
 
823
844
  fragmentPointers[fragmentSpreadOrFragment.name] = inlineData;
824
845
  };
825
846
 
847
+ _proto._addMissingRequiredFields = function _addMissingRequiredFields(additional) {
848
+ if (this._missingRequiredFields == null) {
849
+ this._missingRequiredFields = additional;
850
+ return;
851
+ }
852
+
853
+ if (this._missingRequiredFields.action === 'THROW') {
854
+ return;
855
+ }
856
+
857
+ if (additional.action === 'THROW') {
858
+ this._missingRequiredFields = additional;
859
+ return;
860
+ }
861
+
862
+ this._missingRequiredFields = {
863
+ action: 'LOG',
864
+ fields: [].concat((0, _toConsumableArray2["default"])(this._missingRequiredFields.fields), (0, _toConsumableArray2["default"])(additional.fields))
865
+ };
866
+ };
867
+
826
868
  return RelayReader;
827
869
  }();
828
870
 
@@ -211,6 +211,7 @@ var RelayStoreUtils = {
211
211
  RELAY_RESOLVER_INVALIDATION_KEY: '__resolverValueMayBeInvalid',
212
212
  RELAY_RESOLVER_INPUTS_KEY: '__resolverInputValues',
213
213
  RELAY_RESOLVER_READER_SELECTOR_KEY: '__resolverReaderSelector',
214
+ RELAY_RESOLVER_MISSING_REQUIRED_FIELDS_KEY: '__resolverMissingRequiredFields',
214
215
  formatStorageKey: formatStorageKey,
215
216
  getArgumentValue: getArgumentValue,
216
217
  getArgumentValues: getArgumentValues,
@@ -24,6 +24,7 @@ var RelayModernRecord = require('./RelayModernRecord');
24
24
  var _require2 = require('./RelayStoreUtils'),
25
25
  RELAY_RESOLVER_INPUTS_KEY = _require2.RELAY_RESOLVER_INPUTS_KEY,
26
26
  RELAY_RESOLVER_INVALIDATION_KEY = _require2.RELAY_RESOLVER_INVALIDATION_KEY,
27
+ RELAY_RESOLVER_MISSING_REQUIRED_FIELDS_KEY = _require2.RELAY_RESOLVER_MISSING_REQUIRED_FIELDS_KEY,
27
28
  RELAY_RESOLVER_READER_SELECTOR_KEY = _require2.RELAY_RESOLVER_READER_SELECTOR_KEY,
28
29
  RELAY_RESOLVER_VALUE_KEY = _require2.RELAY_RESOLVER_VALUE_KEY,
29
30
  getStorageKey = _require2.getStorageKey;
@@ -39,7 +40,11 @@ var NoopResolverCache = /*#__PURE__*/function () {
39
40
  var _proto = NoopResolverCache.prototype;
40
41
 
41
42
  _proto.readFromCacheOrEvaluate = function readFromCacheOrEvaluate(record, field, variables, evaluate, getDataForResolverFragment) {
42
- return [evaluate().resolverResult, undefined];
43
+ var _evaluate = evaluate(),
44
+ resolverResult = _evaluate.resolverResult,
45
+ missingRequiredFields = _evaluate.missingRequiredFields;
46
+
47
+ return [resolverResult, undefined, missingRequiredFields];
43
48
  };
44
49
 
45
50
  _proto.invalidateDataIDs = function invalidateDataIDs(updatedDataIDs) {};
@@ -85,6 +90,7 @@ var RecordResolverCache = /*#__PURE__*/function () {
85
90
  RelayModernRecord.setValue(linkedRecord, RELAY_RESOLVER_VALUE_KEY, evaluationResult.resolverResult);
86
91
  RelayModernRecord.setValue(linkedRecord, RELAY_RESOLVER_INPUTS_KEY, evaluationResult.fragmentValue);
87
92
  RelayModernRecord.setValue(linkedRecord, RELAY_RESOLVER_READER_SELECTOR_KEY, evaluationResult.readerSelector);
93
+ RelayModernRecord.setValue(linkedRecord, RELAY_RESOLVER_MISSING_REQUIRED_FIELDS_KEY, evaluationResult.missingRequiredFields);
88
94
  recordSource.set(linkedID, linkedRecord); // Link the resolver value record to the resolver field of the record being read:
89
95
 
90
96
  var nextRecord = RelayModernRecord.clone(record);
@@ -112,7 +118,9 @@ var RecordResolverCache = /*#__PURE__*/function () {
112
118
 
113
119
 
114
120
  var answer = linkedRecord[RELAY_RESOLVER_VALUE_KEY];
115
- return [answer, linkedID];
121
+ var missingRequiredFields = // $FlowFixMe[incompatible-type] - casting mixed
122
+ linkedRecord[RELAY_RESOLVER_MISSING_REQUIRED_FIELDS_KEY];
123
+ return [answer, linkedID, missingRequiredFields];
116
124
  };
117
125
 
118
126
  _proto2.invalidateDataIDs = function invalidateDataIDs(updatedDataIDs) {
@@ -11,14 +11,34 @@
11
11
  // flowlint ambiguous-object-type:error
12
12
  'use strict';
13
13
 
14
- function withProvidedVariables(userSuppliedVariables, parameters) {
15
- var providedVariables = parameters.providedVariables;
14
+ var areEqual = require("fbjs/lib/areEqual");
16
15
 
16
+ var warning = require("fbjs/lib/warning");
17
+
18
+ var WEAKMAP_SUPPORTED = typeof WeakMap === 'function';
19
+ var debugCache = WEAKMAP_SUPPORTED ? new WeakMap() : new Map();
20
+
21
+ function withProvidedVariables(userSuppliedVariables, providedVariables) {
17
22
  if (providedVariables != null) {
18
23
  var operationVariables = {};
19
24
  Object.assign(operationVariables, userSuppliedVariables);
20
25
  Object.keys(providedVariables).forEach(function (varName) {
21
- operationVariables[varName] = providedVariables[varName].get();
26
+ var providerFunction = providedVariables[varName].get;
27
+ var providerResult = providerFunction(); // people like to ignore these warnings, so use the cache to
28
+ // enforce that we only compute the value the first time
29
+
30
+ if (!debugCache.has(providerFunction)) {
31
+ debugCache.set(providerFunction, providerResult);
32
+ operationVariables[varName] = providerResult;
33
+ } else {
34
+ var cachedResult = debugCache.get(providerFunction);
35
+
36
+ if (process.env.NODE_ENV !== "production") {
37
+ process.env.NODE_ENV !== "production" ? warning(areEqual(providerResult, cachedResult), 'Relay: Expected function `%s` for provider `%s` to be a pure function, ' + 'but got conflicting return values `%s` and `%s`', providerFunction.name, varName, providerResult, cachedResult) : void 0;
38
+ }
39
+
40
+ operationVariables[varName] = cachedResult;
41
+ }
22
42
  });
23
43
  return operationVariables;
24
44
  } else {
@@ -37,32 +37,15 @@ const validateMutation = require('./validateMutation');
37
37
  const invariant = require('invariant');
38
38
  const warning = require('warning');
39
39
 
40
- export type DEPRECATED_MutationConfig<TMutationResponse> = {|
41
- configs?: Array<DeclarativeMutationConfig>,
42
- cacheConfig?: CacheConfig,
43
- mutation: GraphQLTaggedNode,
44
- variables: Variables,
45
- uploadables?: UploadableMap,
46
- onCompleted?: ?(
47
- response: TMutationResponse,
48
- errors: ?Array<PayloadError>,
49
- ) => void,
50
- onError?: ?(error: Error) => void,
51
- onUnsubscribe?: ?() => void,
52
- optimisticUpdater?: ?SelectorStoreUpdater<TMutationResponse>,
53
- optimisticResponse?: Object,
54
- updater?: ?SelectorStoreUpdater<TMutationResponse>,
55
- |};
56
-
57
40
  export type MutationConfig<TMutation: MutationParameters> = {|
58
- configs?: Array<DeclarativeMutationConfig>,
59
41
  cacheConfig?: CacheConfig,
42
+ configs?: Array<DeclarativeMutationConfig>,
60
43
  mutation: GraphQLTaggedNode,
61
- onError?: ?(error: Error) => void,
62
44
  onCompleted?: ?(
63
45
  response: TMutation['response'],
64
46
  errors: ?Array<PayloadError>,
65
47
  ) => void,
48
+ onError?: ?(error: Error) => void,
66
49
  onNext?: ?() => void,
67
50
  onUnsubscribe?: ?() => void,
68
51
  optimisticResponse?: {
@@ -76,6 +59,12 @@ export type MutationConfig<TMutation: MutationParameters> = {|
76
59
  variables: TMutation['variables'],
77
60
  |};
78
61
 
62
+ export type DEPRECATED_MutationConfig<TMutationResponse> = MutationConfig<{|
63
+ response: TMutationResponse,
64
+ rawResponse: any,
65
+ variables: Variables,
66
+ |}>;
67
+
79
68
  /**
80
69
  * Higher-level helper function to execute a mutation against a specific
81
70
  * environment.
@@ -21,7 +21,7 @@ import type {OperationType} from '../util/RelayRuntimeTypes';
21
21
  const {getRequest} = require('../query/GraphQLTag');
22
22
  const {getArgumentValues} = require('../store/RelayStoreUtils');
23
23
 
24
- const nonUpdatableKeys = ['id', '__id', '__typename'];
24
+ const nonUpdatableKeys = ['id', '__id', '__typename', 'js'];
25
25
 
26
26
  function readUpdatableQuery_EXPERIMENTAL<TQuery: OperationType>(
27
27
  query: GraphQLTaggedNode,
@@ -214,7 +214,7 @@ function createSetterForSingularLinkedField<TQuery: OperationType>(
214
214
  const variables = getArgumentValues(selection.args ?? [], queryVariables);
215
215
  if (newValue == null) {
216
216
  // $FlowFixMe[unclear-type] No good way to type these variables
217
- recordProxy.setValue(null, selection.name, (variables: any));
217
+ recordProxy.setValue(newValue, selection.name, (variables: any));
218
218
  } else {
219
219
  const {__id} = newValue;
220
220
  if (__id == null) {
@@ -46,7 +46,10 @@ function create(
46
46
  uploadables?: ?UploadableMap,
47
47
  logRequestInfo: ?LogRequestInfoFunction,
48
48
  ): RelayObservable<GraphQLResponse> {
49
- const operationVariables = withProvidedVariables(variables, request);
49
+ const operationVariables = withProvidedVariables(
50
+ variables,
51
+ request.providedVariables,
52
+ );
50
53
  if (request.operationKind === 'subscription') {
51
54
  invariant(
52
55
  subscribe,
@@ -26,7 +26,7 @@ export interface INetwork {
26
26
 
27
27
  export type LogRequestInfoFunction = mixed => void;
28
28
 
29
- export type PayloadData = interface {[key: string]: mixed};
29
+ export type PayloadData = {[key: string]: mixed};
30
30
 
31
31
  export type PayloadError = interface {
32
32
  message: string,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-runtime",
3
3
  "description": "A core runtime for building GraphQL-driven applications.",
4
- "version": "13.0.1",
4
+ "version": "13.0.2",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"