relay-runtime 0.0.0-main-d543a7a5 → 0.0.0-main-c844a5ba
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/index.js
CHANGED
package/lib/store/RelayReader.js
CHANGED
|
@@ -466,9 +466,7 @@ var RelayReader = /*#__PURE__*/function () {
|
|
|
466
466
|
throw new Error('Relay Resolver fields are not yet supported.');
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
this._readResolverField(selection.field, record, data);
|
|
470
|
-
|
|
471
|
-
break;
|
|
469
|
+
return this._readResolverField(selection.field, record, data);
|
|
472
470
|
|
|
473
471
|
default:
|
|
474
472
|
selection.field.kind;
|
|
@@ -550,6 +548,7 @@ var RelayReader = /*#__PURE__*/function () {
|
|
|
550
548
|
|
|
551
549
|
var applicationName = (_field$alias = field.alias) !== null && _field$alias !== void 0 ? _field$alias : field.name;
|
|
552
550
|
data[applicationName] = result;
|
|
551
|
+
return result;
|
|
553
552
|
};
|
|
554
553
|
|
|
555
554
|
_proto._readClientEdge = function _readClientEdge(field, record, data) {
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
// flowlint ambiguous-object-type:error
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var areEqual = require("fbjs/lib/areEqual");
|
|
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
|
+
|
|
14
21
|
function withProvidedVariables(userSuppliedVariables, parameters) {
|
|
15
22
|
var providedVariables = parameters.providedVariables;
|
|
16
23
|
|
|
@@ -18,7 +25,22 @@ function withProvidedVariables(userSuppliedVariables, parameters) {
|
|
|
18
25
|
var operationVariables = {};
|
|
19
26
|
Object.assign(operationVariables, userSuppliedVariables);
|
|
20
27
|
Object.keys(providedVariables).forEach(function (varName) {
|
|
21
|
-
|
|
28
|
+
var providerFunction = providedVariables[varName].get;
|
|
29
|
+
var providerResult = providerFunction(); // people like to ignore these warnings, so use the cache to
|
|
30
|
+
// enforce that we only compute the value the first time
|
|
31
|
+
|
|
32
|
+
if (!debugCache.has(providerFunction)) {
|
|
33
|
+
debugCache.set(providerFunction, providerResult);
|
|
34
|
+
operationVariables[varName] = providerResult;
|
|
35
|
+
} else {
|
|
36
|
+
var cachedResult = debugCache.get(providerFunction);
|
|
37
|
+
|
|
38
|
+
if (process.env.NODE_ENV !== "production") {
|
|
39
|
+
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;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
operationVariables[varName] = cachedResult;
|
|
43
|
+
}
|
|
22
44
|
});
|
|
23
45
|
return operationVariables;
|
|
24
46
|
} else {
|