diff --git a/src/isomorphic/classic/element/ReactElement.js b/src/isomorphic/classic/element/ReactElement.js index c35293159e..379c81fc51 100644 --- a/src/isomorphic/classic/element/ReactElement.js +++ b/src/isomorphic/classic/element/ReactElement.js @@ -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; diff --git a/src/renderers/shared/reconciler/ReactUpdateQueue.js b/src/renderers/shared/reconciler/ReactUpdateQueue.js index bd83661139..d2e7cadb28 100644 --- a/src/renderers/shared/reconciler/ReactUpdateQueue.js +++ b/src/renderers/shared/reconciler/ReactUpdateQueue.js @@ -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);