WIP - add extractor, generate snippet_data
This commit is contained in:
37
node_modules/relay-runtime/lib/cloneRelayHandleSourceField.js
generated
vendored
Normal file
37
node_modules/relay-runtime/lib/cloneRelayHandleSourceField.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* strict-local
|
||||
* @format
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var _objectSpread2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/objectSpread"));
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Creates a clone of the supplied `handleField` by finding the original linked
|
||||
* field (on which the handle was declared) among the sibling `selections`, and
|
||||
* copying its selections into the clone.
|
||||
*/
|
||||
function cloneRelayHandleSourceField(handleField, selections, variables) {
|
||||
var sourceField = selections.find(function (source) {
|
||||
return source.kind === require("./RelayConcreteNode").LINKED_FIELD && source.name === handleField.name && source.alias === handleField.alias && require("fbjs/lib/areEqual")(source.args, handleField.args);
|
||||
});
|
||||
!(sourceField && sourceField.kind === require("./RelayConcreteNode").LINKED_FIELD) ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'cloneRelayHandleSourceField: Expected a corresponding source field for ' + 'handle `%s`.', handleField.handle) : require("fbjs/lib/invariant")(false) : void 0;
|
||||
|
||||
var handleKey = require("./RelayStoreUtils").getHandleStorageKey(handleField, variables);
|
||||
|
||||
var clonedField = (0, _objectSpread2["default"])({}, sourceField, {
|
||||
args: null,
|
||||
name: handleKey,
|
||||
storageKey: handleKey
|
||||
});
|
||||
return clonedField;
|
||||
}
|
||||
|
||||
module.exports = cloneRelayHandleSourceField;
|
||||
Reference in New Issue
Block a user