Merge pull request #6082 from spicyj/nq-set-props

Remove unused enqueueSetProps methods
This commit is contained in:
Ben Alpert
2016-02-26 00:39:48 -08:00
2 changed files with 0 additions and 106 deletions
@@ -249,25 +249,6 @@ ReactElement.cloneAndReplaceKey = function(oldElement, newKey) {
return newElement;
};
ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
var newElement = ReactElement(
oldElement.type,
oldElement.key,
oldElement.ref,
oldElement._self,
oldElement._source,
oldElement._owner,
newProps
);
if (__DEV__) {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
return newElement;
};
ReactElement.cloneElement = function(element, config, children) {
var propName;
@@ -12,11 +12,9 @@
'use strict';
var ReactCurrentOwner = require('ReactCurrentOwner');
var ReactElement = require('ReactElement');
var ReactInstanceMap = require('ReactInstanceMap');
var ReactUpdates = require('ReactUpdates');
var assign = require('Object.assign');
var invariant = require('invariant');
var warning = require('warning');
@@ -239,91 +237,6 @@ var ReactUpdateQueue = {
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function(publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'setProps'
);
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
},
enqueueSetPropsInternal: function(internalInstance, partialProps) {
var topLevelWrapper = internalInstance._topLevelWrapper;
invariant(
topLevelWrapper,
'setProps(...): You called `setProps` on a ' +
'component with a parent. This is an anti-pattern since props will ' +
'get reactively updated when rendered. Instead, change the owner\'s ' +
'`render` method to pass the correct value as props to the component ' +
'where it is created.'
);
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement ||
topLevelWrapper._currentElement;
var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(
wrapElement,
ReactElement.cloneAndReplaceProps(element, props)
);
enqueueUpdate(topLevelWrapper);
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function(publicInstance, props) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'replaceProps'
);
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
},
enqueueReplacePropsInternal: function(internalInstance, props) {
var topLevelWrapper = internalInstance._topLevelWrapper;
invariant(
topLevelWrapper,
'replaceProps(...): You called `replaceProps` on a ' +
'component with a parent. This is an anti-pattern since props will ' +
'get reactively updated when rendered. Instead, change the owner\'s ' +
'`render` method to pass the correct value as props to the component ' +
'where it is created.'
);
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement ||
topLevelWrapper._currentElement;
var element = wrapElement.props;
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(
wrapElement,
ReactElement.cloneAndReplaceProps(element, props)
);
enqueueUpdate(topLevelWrapper);
},
enqueueElementInternal: function(internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);