Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-redux

Package Overview
Dependencies
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-redux - npm Package Compare versions

Comparing version 6.0.0-alpha.9210282 to 6.0.0-alpha.2a2f108

es/components/Context.js

2

dist/react-redux.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux")):"function"==typeof define&&define.amd?define(["exports","react","redux"],t):t(e.ReactRedux={},e.React,e.Redux)}(this,function(e,t,r){"use strict";var n="default"in t?t.default:t;function o(e,t){return e(t={exports:{}},t.exports),t.exports}function i(e){return function(){return e}}var a=function(){};a.thatReturns=i,a.thatReturnsFalse=i(!1),a.thatReturnsTrue=i(!0),a.thatReturnsNull=i(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(e){return e};var s=a,u=function(e){};var p=function(e,t,r,n,o,i,a,s){if(u(t),!e){var p;if(void 0===t)p=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,a,s],f=0;(p=Error(t.replace(/%s/g,function(){return c[f++]}))).name="Invariant Violation"}throw p.framesToPop=1,p}},c="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",f=o(function(e){e.exports=function(){function e(e,t,r,n,o,i){i!==c&&p(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=s,r.PropTypes=r,r}()}),d=f.shape({subscribe:f.func.isRequired,dispatch:f.func.isRequired,getState:f.func.isRequired}),l=n.createContext(null),h=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},v=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},y=function(e,t){var r={};for(var n in e)0>t.indexOf(n)&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},P=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};function b(){var e=function(e){function t(r){h(this,t);var n=P(this,e.call(this,r)),o=r.store;return n.state={storeState:o.getState(),store:o},n}return m(t,e),t.prototype.componentDidMount=function(){this._isMounted=!0,this.subscribe()},t.prototype.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this._isMounted=!1},t.prototype.componentDidUpdate=function(e){this.props.store!==e.store&&(this.unsubscribe&&this.unsubscribe(),this.subscribe())},t.prototype.subscribe=function(){var e=this,t=this.props.store;this.unsubscribe=t.subscribe(function(){var r=t.getState();e._isMounted&&e.setState(function(e){return e.storeState===r?null:{storeState:r}})});var r=t.getState();r!==this.state.storeState&&this.setState({storeState:r})},t.prototype.render=function(){return n.createElement(this.props.contextProvider||l.Provider,{value:this.state},this.props.children)},t}(t.Component);return e.propTypes={store:d.isRequired,children:f.element.isRequired,contextProvider:f.object},e}var w=b(),O={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},g={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},S=Object.defineProperty,C=Object.getOwnPropertyNames,T=Object.getOwnPropertySymbols,x=Object.getOwnPropertyDescriptor,R=Object.getPrototypeOf,E=R&&R(Object);var j,M=function e(t,r,n){if("string"!=typeof r){if(E){var o=R(r);o&&o!==E&&e(t,o,n)}var i=C(r);T&&(i=i.concat(T(r)));for(var a=0;i.length>a;++a){var s=i[a];if(!(O[s]||g[s]||n&&n[s])){var u=x(r,s);try{S(t,s,u)}catch(e){}}}return t}return t},_=function(e,t,r,n,o,i,a,s){if(!e){var u;if(void 0===t)u=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[r,n,o,i,a,s],c=0;(u=Error(t.replace(/%s/g,function(){return p[c++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}},q=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,a=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,u=r?Symbol.for("react.provider"):60109,p=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.timeout"):60113;function l(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case c:case i:case s:case a:return e;default:switch(e=e&&e.$$typeof){case p:case f:case u:return e;default:return t}}case o:return t}}}t.typeOf=l,t.AsyncMode=c,t.ContextConsumer=p,t.ContextProvider=u,t.Element=n,t.ForwardRef=f,t.Fragment=i,t.Profiler=s,t.Portal=o,t.StrictMode=a,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===s||e===a||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===u||e.$$typeof===p||e.$$typeof===f)},t.isAsyncMode=function(e){return l(e)===c},t.isContextConsumer=function(e){return l(e)===p},t.isContextProvider=function(e){return l(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return l(e)===f},t.isFragment=function(e){return l(e)===i},t.isProfiler=function(e){return l(e)===s},t.isPortal=function(e){return l(e)===o},t.isStrictMode=function(e){return l(e)===a}});(j=q)&&j.__esModule&&Object.prototype.hasOwnProperty.call(j,"default");var N=o(function(e){e.exports=q}).isValidElementType,D=0;function F(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.getDisplayName,i=void 0===o?function(e){return"ConnectAdvanced("+e+")"}:o,a=r.methodName,s=void 0===a?"connectAdvanced":a,u=r.shouldHandleStateChanges,p=void 0===u||u,c=r.consumer,b=void 0===c?l.Consumer:c,w=r.storeKey,O=void 0===w?"store":w,g=r.withRef,S=void 0!==g&&g,C=r.forwardRef,T=void 0!==C&&C,x=y(r,["getDisplayName","methodName","shouldHandleStateChanges","consumer","storeKey","withRef","forwardRef"]);_(!S,"withRef is removed. To access the wrapped instance, use a ref on the connected component"),_("store"===O,"storeKey has been removed. To use a custom redux store for a single component, create a custom React context with React.createContext() and pass the Provider to react-redux's provider and the Consumer to this component as in <Provider context={context.Provider}><ConnectedComponent consumer={context.Consumer} /></Provider>");var R=D++;return function(r){_(N(r),"You must pass a component to the function returned by "+s+". Instead received "+JSON.stringify(r));var o=r.displayName||r.name||"Component",a=i(o),u=v({},x,{getDisplayName:i,methodName:s,shouldHandleStateChanges:p,displayName:a,wrappedComponentName:o,WrappedComponent:r}),c=x.pure?t.PureComponent:t.Component;function l(t){return e(t.dispatch,u)}var w=function(e){function t(r){h(this,t);var n=P(this,e.call(this,r));return n.state={wrapperProps:r.wrapperProps,store:r.store,error:null,childPropsSelector:l(r.store),childProps:{}},n.state=v({},n.state,t.getChildPropsState(r,n.state)),n}return m(t,e),t.getChildPropsState=function(e,t){try{var r=t.childPropsSelector;e.store!==t.store&&(r=l(e.store));var n=r(e.storeState,e.wrapperProps);return n===t.childProps?null:{childProps:n,store:e.store,childPropsSelector:r}}catch(e){return{error:e}}},t.getDerivedStateFromProps=function(e,r){var n=t.getChildPropsState(e,r);return null===n?null:v({},n,{wrapperProps:e.wrapperProps})},t.prototype.shouldComponentUpdate=function(e,t){return t.childProps!==this.state.childProps||!!t.error},t.prototype.render=function(){if(this.state.error)throw this.state.error;return n.createElement(r,v({},this.state.childProps,{ref:this.props.forwardRef}))},t}(t.Component);w.propTypes={wrapperProps:f.object,store:d};var O=function(e){function t(r){h(this,t);var n,o=P(this,e.call(this,r));return o.version=R,o.renderInner=o.renderInner.bind(o),o.wrapperPropsMemoizer=(n=void 0,function(e){if(void 0===e)return n;var t=e.contextConsumer,r=e.forwardRef,o=y(e,["contextConsumer","forwardRef"]);return n={contextConsumer:t,forwardRef:r,wrapperProps:o}}),o}return m(t,e),t.prototype.renderInner=function(e){var t=e.storeState,r=e.store,o=this.wrapperPropsMemoizer(this.props);return n.createElement(w,{key:this.version,storeState:t,store:r,wrapperProps:o.wrapperProps,forwardRef:o.forwardRef})},t.prototype.render=function(){return n.createElement(this.props.contextConsumer||b,null,this.renderInner)},t}(c);O.WrappedComponent=r,O.displayName=a,O.propTypes={contextConsumer:f.object,forwardRef:f.oneOfType([f.func,f.object])};var g=O;T&&(g=n.forwardRef(function(e,t){return n.createElement(O,v({},e,{forwardRef:t}))}));return M(g,r)}}var $=Object.prototype.hasOwnProperty;function I(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function A(e,t){if(I(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var n=0;r.length>n;n++)if(!$.call(t,r[n])||!I(e[r[n]],t[r[n]]))return!1;return!0}function k(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function H(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function U(e,t){return function(t,r){var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=H(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=H(o),o=n(t,r)),o},n}}var V=[function(e){return"function"==typeof e?U(e):void 0},function(e){return e?void 0:k(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?k(function(t){return r.bindActionCreators(e,t)}):void 0}];var W=[function(e){return"function"==typeof e?U(e):void 0},function(e){return e?void 0:k(function(){return{}})}];function K(e,t,r){return v({},r,e,t)}var z=[function(e){return"function"==typeof e?function(e){return function(t,r){var n=r.pure,o=r.areMergedPropsEqual,i=!1,a=void 0;return function(t,r,s){var u=e(t,r,s);return i?n&&o(u,a)||(a=u):(i=!0,a=u),a}}}(e):void 0},function(e){return e?void 0:function(){return K}}];function L(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Y(e,t,r,n,o){var i=o.areStatesEqual,a=o.areOwnPropsEqual,s=o.areStatePropsEqual,u=!1,p=void 0,c=void 0,f=void 0,d=void 0,l=void 0;function h(o,u){var h,v,m=!a(u,c),y=!i(o,p);return p=o,c=u,m&&y?(f=e(p,c),t.dependsOnOwnProps&&(d=t(n,c)),l=r(f,d,c)):m?(e.dependsOnOwnProps&&(f=e(p,c)),t.dependsOnOwnProps&&(d=t(n,c)),l=r(f,d,c)):y?(h=e(p,c),v=!s(h,f),f=h,v&&(l=r(f,d,c)),l):l}return function(o,i){return u?h(o,i):(f=e(p=o,c=i),d=t(n,c),l=r(f,d,c),u=!0,l)}}function B(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=y(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=r(e,i),s=n(e,i),u=o(e,i);return(i.pure?Y:L)(a,s,u,e,i)}function J(e,t,r){for(var n=t.length-1;n>=0;n--){var o=t[n](e);if(o)return o}return function(t,n){throw Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function G(e,t){return e===t}var Q=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.connectHOC,r=void 0===t?F:t,n=e.mapStateToPropsFactories,o=void 0===n?W:n,i=e.mapDispatchToPropsFactories,a=void 0===i?V:i,s=e.mergePropsFactories,u=void 0===s?z:s,p=e.selectorFactory,c=void 0===p?B:p;return function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=i.pure,p=void 0===s||s,f=i.areStatesEqual,d=void 0===f?G:f,l=i.areOwnPropsEqual,h=void 0===l?A:l,m=i.areStatePropsEqual,P=void 0===m?A:m,b=i.areMergedPropsEqual,w=void 0===b?A:b,O=y(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),g=J(e,o,"mapStateToProps"),S=J(t,a,"mapDispatchToProps"),C=J(n,u,"mergeProps");return r(c,v({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:g,initMapDispatchToProps:S,initMergeProps:C,pure:p,areStatesEqual:d,areOwnPropsEqual:h,areStatePropsEqual:P,areMergedPropsEqual:w},O))}}();e.Provider=w,e.createProvider=b,e.connectAdvanced=F,e.connect=Q,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux")):"function"==typeof define&&define.amd?define(["exports","react","redux"],t):t(e.ReactRedux={},e.React,e.Redux)}(this,function(e,t,r){"use strict";var o="default"in t?t.default:t;function n(e,t){return e(t={exports:{}},t.exports),t.exports}var i="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function a(){}var s=n(function(e){e.exports=function(){function e(e,t,r,o,n,a){if(a!==i){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=a,r.PropTypes=r,r}()}),p=o.createContext(null),u=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},d=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},f=function(e,t){var r={};for(var o in e)0>t.indexOf(o)&&Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r},l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},v=p.Provider,m=function(e){function t(r){u(this,t);var o=l(this,e.call(this,r));return o.state={state:r.store.getState(),store:r.store},o.unsubscribe=null,o}return d(t,e),t.prototype.componentDidMount=function(){this.isUnmounted=!1;var e=this.state.store.getState();this.unsubscribe=this.state.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this)),e!==this.state.state&&this.setState({state:e})},t.prototype.componentWillUnmount=function(){this.isUnmounted=!0,this.unsubscribe&&this.unsubscribe()},t.prototype.componentDidUpdate=function(e){e.store!==this.props.store&&(this.unsubscribe&&this.unsubscribe(),this.unsubscribe=this.props.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this)),this.setState({state:this.props.store.getState(),store:this.props.store}))},t.prototype.triggerUpdateOnStoreStateChange=function(){this.isUnmounted||this.setState(function(e){var t=e.store.getState();return e.state===t?null:{state:t}})},t.prototype.render=function(){return o.createElement(this.props.context||v,{value:this.state},this.props.children)},t}(t.Component);m.propTypes={store:s.shape({subscribe:s.func.isRequired,dispatch:s.func.isRequired,getState:s.func.isRequired}),context:s.object,children:s.any};var h,y=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,n=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,a=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,p=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.timeout"):60113;function l(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case c:case i:case s:case a:return e;default:switch(e=e&&e.$$typeof){case u:case d:case p:return e;default:return t}}case n:return t}}}t.typeOf=l,t.AsyncMode=c,t.ContextConsumer=u,t.ContextProvider=p,t.Element=o,t.ForwardRef=d,t.Fragment=i,t.Profiler=s,t.Portal=n,t.StrictMode=a,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===s||e===a||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===u||e.$$typeof===d)},t.isAsyncMode=function(e){return l(e)===c},t.isContextConsumer=function(e){return l(e)===u},t.isContextProvider=function(e){return l(e)===p},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return l(e)===d},t.isFragment=function(e){return l(e)===i},t.isProfiler=function(e){return l(e)===s},t.isPortal=function(e){return l(e)===n},t.isStrictMode=function(e){return l(e)===a}});(h=y)&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default");var P,b=n(function(e){e.exports=y}),g=b.isValidElementType;function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var w={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},C={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},S=O({},b.ForwardRef,(O(P={},"$$typeof",!0),O(P,"render",!0),P)),x=Object.defineProperty,E=Object.getOwnPropertyNames,T=Object.getOwnPropertySymbols,R=Object.getOwnPropertyDescriptor,j=Object.getPrototypeOf,_=Object.prototype;var q=function e(t,r,o){if("string"!=typeof r){if(_){var n=j(r);n&&n!==_&&e(t,n,o)}var i=E(r);T&&(i=i.concat(T(r)));for(var a=S[t.$$typeof]||w,s=S[r.$$typeof]||w,p=0;i.length>p;++p){var u=i[p];if(!(C[u]||o&&o[u]||s&&s[u]||a&&a[u])){var c=R(r,u);try{x(t,u,c)}catch(e){}}}return t}return t},D=function(e,t,r,o,n,i,a,s){if(!e){var p;if(void 0===t)p=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,o,n,i,a,s],c=0;(p=Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw p.framesToPop=1,p}},M=p.Consumer;function N(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,a=r.methodName,p=void 0===a?"connectAdvanced":a,v=r.renderCountProp,m=void 0===v?void 0:v,h=r.shouldHandleStateChanges,y=void 0===h||h,P=r.storeKey,b=void 0===P?"store":P,O=r.withRef,w=void 0!==O&&O,C=r.consumer,S=void 0===C?M:C,x=f(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","consumer"]);D(void 0===m,"renderCountProp is removed. render counting is built into the latest React dev tools profiling extension"),D(!w,"withRef is removed. To access the wrapped instance, use a ref on the connected component"),D("store"===b,"storeKey has been removed and does not do anything. To use a custom redux store for a single component, create a custom React context with React.createContext() and pass the Provider to react-redux's provider and the Consumer to this component as in <Provider context={context.Provider}><ConnectedComponent consumer={context.Consumer} /></Provider>");var E=S;return function(r){D(g(r),"You must pass a component to the function returned by "+p+". Instead received "+JSON.stringify(r));var n=r.displayName||r.name||"Component",a=i(n),f=void 0;if(w){var v=function(e){function t(){return u(this,t),l(this,e.apply(this,arguments))}return d(t,e),t.prototype.shouldComponentUpdate=function(e){return e.derivedProps!==this.props.derivedProps},t.prototype.render=function(){var e=this.props;return o.createElement(r,c({},e.derivedProps,{ref:e.forwardRef}))},t}(t.Component);v.propTypes={derivedProps:s.object,forwardRef:s.oneOfType([s.func,s.object])},f=v}else{var h=function(e){function t(){return u(this,t),l(this,e.apply(this,arguments))}return d(t,e),t.prototype.shouldComponentUpdate=function(e){return e.derivedProps!==this.props.derivedProps},t.prototype.render=function(){return o.createElement(r,this.props.derivedProps)},t}(t.Component);h.propTypes={derivedProps:s.object},f=h}var P=c({},x,{getDisplayName:i,methodName:p,renderCountProp:m,shouldHandleStateChanges:y,storeKey:b,displayName:a,wrappedComponentName:n,WrappedComponent:r}),O=function(t){function i(e){u(this,i);var r=l(this,t.call(this,e));return D(w?!e.props[b]:!e[b],"Passing redux store in props has been removed and does not do anything. To use a custom redux store for a single component, create a custom React context with React.createContext() and pass the Provider to react-redux's provider and the Consumer to this component's connect as in <Provider context={context.Provider}></Provider> and connect(mapState, mapDispatch, undefined, { consumer=context.consumer })("+n+")"),r.generatedDerivedProps=r.makeDerivedPropsGenerator(),r.renderWrappedComponent=r.renderWrappedComponent.bind(r),r}return d(i,t),i.prototype.makeDerivedPropsGenerator=function(){var t=void 0,r=void 0,o=void 0,n=void 0,i=void 0;return function(a,s,p){if(x.pure&&t===s&&r===a)return o;p!==n&&(n=p,i=e(p.dispatch,P)),t=s,r=a;var u=i(a,s);return o===u?o:o=u}},i.prototype.renderWrappedComponentWithRef=function(e){D(e,'Could not find "store" in the context of "'+a+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+a+" in connect options.");var t=this.props,n=t.forwardRef,i=this.generatedDerivedProps(e.state,t.props,e.store);return x.pure?o.createElement(f,{derivedProps:i,forwardRef:n}):o.createElement(r,c({},i,{ref:n}))},i.prototype.renderWrappedComponent=function(e){D(e,'Could not find "store" in the context of "'+a+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+a+" in connect options.");var t=this.generatedDerivedProps(e.state,this.props,e.store);return x.pure?o.createElement(f,{derivedProps:t}):o.createElement(r,t)},i.prototype.render=function(){return o.createElement(E,this.props.unstable_observedBits?{unstable_observedBits:this.props.unstable_observedBits}:null,this.renderWrappedComponent)},i}(x.pure?t.PureComponent:t.Component);if(O.WrappedComponent=r,O.displayName=a,w&&(O.prototype.renderWrappedComponent=O.prototype.renderWrappedComponentWithRef,O.propTypes={props:s.object,forwardRef:s.oneOfType([s.func,s.object])}),!w)return q(O,r);function w(e,t){return o.createElement(O,{props:e,forwardRef:t})}var C=o.forwardRef(w);return C.displayName=a,C.WrappedComponent=r,q(C,r)}}var $=Object.prototype.hasOwnProperty;function W(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function U(e,t){if(W(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var o=0;r.length>o;o++)if(!$.call(t,r[o])||!W(e[r[o]],t[r[o]]))return!1;return!0}function F(e){return function(t,r){var o=e(t,r);function n(){return o}return n.dependsOnOwnProps=!1,n}}function k(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function A(e,t){return function(t,r){var o=function(e,t){return o.dependsOnOwnProps?o.mapToProps(e,t):o.mapToProps(e)};return o.dependsOnOwnProps=!0,o.mapToProps=function(t,r){o.mapToProps=e,o.dependsOnOwnProps=k(e);var n=o(t,r);return"function"==typeof n&&(o.mapToProps=n,o.dependsOnOwnProps=k(n),n=o(t,r)),n},o}}var I=[function(e){return"function"==typeof e?A(e):void 0},function(e){return e?void 0:F(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?F(function(t){return r.bindActionCreators(e,t)}):void 0}];var H=[function(e){return"function"==typeof e?A(e):void 0},function(e){return e?void 0:F(function(){return{}})}];function B(e,t,r){return c({},r,e,t)}var K=[function(e){return"function"==typeof e?function(e){return function(t,r){var o=r.pure,n=r.areMergedPropsEqual,i=!1,a=void 0;return function(t,r,s){var p=e(t,r,s);return i?o&&n(p,a)||(a=p):(i=!0,a=p),a}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function V(e,t,r,o){return function(n,i){return r(e(n,i),t(o,i),i)}}function G(e,t,r,o,n){var i=n.areStatesEqual,a=n.areOwnPropsEqual,s=n.areStatePropsEqual,p=!1,u=void 0,c=void 0,d=void 0,f=void 0,l=void 0;function v(n,p){var v,m,h=!a(p,c),y=!i(n,u);return u=n,c=p,h&&y?(d=e(u,c),t.dependsOnOwnProps&&(f=t(o,c)),l=r(d,f,c)):h?(e.dependsOnOwnProps&&(d=e(u,c)),t.dependsOnOwnProps&&(f=t(o,c)),l=r(d,f,c)):y?(v=e(u,c),m=!s(v,d),d=v,m&&(l=r(d,f,c)),l):l}return function(n,i){return p?v(n,i):(d=e(u=n,c=i),f=t(o,c),l=r(d,f,c),p=!0,l)}}function L(e,t){var r=t.initMapStateToProps,o=t.initMapDispatchToProps,n=t.initMergeProps,i=f(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=r(e,i),s=o(e,i),p=n(e,i);return(i.pure?G:V)(a,s,p,e,i)}function Y(e,t,r){for(var o=t.length-1;o>=0;o--){var n=t[o](e);if(n)return n}return function(t,o){throw Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+o.wrappedComponentName+".")}}function J(e,t){return e===t}var z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.connectHOC,r=void 0===t?N:t,o=e.mapStateToPropsFactories,n=void 0===o?H:o,i=e.mapDispatchToPropsFactories,a=void 0===i?I:i,s=e.mergePropsFactories,p=void 0===s?K:s,u=e.selectorFactory,d=void 0===u?L:u;return function(e,t,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=i.pure,u=void 0===s||s,l=i.areStatesEqual,v=void 0===l?J:l,m=i.areOwnPropsEqual,h=void 0===m?U:m,y=i.areStatePropsEqual,P=void 0===y?U:y,b=i.areMergedPropsEqual,g=void 0===b?U:b,O=f(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),w=Y(e,n,"mapStateToProps"),C=Y(t,a,"mapDispatchToProps"),S=Y(o,p,"mergeProps");return r(d,c({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:w,initMapDispatchToProps:C,initMergeProps:S,pure:u,areStatesEqual:v,areOwnPropsEqual:h,areStatePropsEqual:P,areMergedPropsEqual:g},O))}}();e.Provider=m,e.connectAdvanced=N,e.Context=p,e.connect=z,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -13,10 +13,9 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import invariant from 'invariant';
import PropTypes from 'prop-types';
import React, { Component, PureComponent } from 'react';
import propTypes from 'prop-types';
import { isValidElementType } from 'react-is';
import { ReactReduxContext } from "./context";
import { storeShape } from "../utils/PropTypes";
import Context from './Context';
var hotReloadingVersion = 0;
var ReduxConsumer = Context.Consumer;

@@ -46,6 +45,6 @@ export default function connectAdvanced(

methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName,
_ref$renderCountProp = _ref.renderCountProp,
renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp,
_ref$shouldHandleStat = _ref.shouldHandleStateChanges,
shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat,
_ref$consumer = _ref.consumer,
consumer = _ref$consumer === undefined ? ReactReduxContext.Consumer : _ref$consumer,
_ref$storeKey = _ref.storeKey,

@@ -57,9 +56,13 @@ storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey,

forwardRef = _ref$forwardRef === undefined ? false : _ref$forwardRef,
connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'shouldHandleStateChanges', 'consumer', 'storeKey', 'withRef', 'forwardRef']);
_ref$consumer = _ref.consumer,
consumer = _ref$consumer === undefined ? ReduxConsumer : _ref$consumer,
connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef', 'forwardRef', 'consumer']);
invariant(renderCountProp === undefined, 'renderCountProp is removed. render counting is built into the latest React dev tools profiling extension');
invariant(!withRef, "withRef is removed. To access the wrapped instance, use a ref on the connected component");
invariant(storeKey === 'store', 'storeKey has been removed. To use a custom redux store for a single component, ' + 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' + 'and the Consumer to this component as in <Provider context={context.Provider}><' + 'ConnectedComponent consumer={context.Consumer} /></Provider>');
invariant(storeKey === 'store', 'storeKey has been removed and does not do anything. To use a custom redux store for a single component, ' + 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' + 'and the Consumer to this component as in <Provider context={context.Provider}><' + 'ConnectedComponent consumer={context.Consumer} /></Provider>');
var version = hotReloadingVersion++;
var Consumer = consumer;

@@ -73,149 +76,154 @@ return function wrapWithConnect(WrappedComponent) {

var selectorFactoryOptions = _extends({}, connectOptions, {
getDisplayName: getDisplayName,
methodName: methodName,
shouldHandleStateChanges: shouldHandleStateChanges,
displayName: displayName,
wrappedComponentName: wrappedComponentName,
WrappedComponent: WrappedComponent
});
var PureWrapper = void 0;
var OuterBaseComponent = connectOptions.pure ? PureComponent : Component;
if (forwardRef) {
var PureWrapperRef = function (_Component) {
_inherits(PureWrapperRef, _Component);
function createChildSelector(store) {
return selectorFactory(store.dispatch, selectorFactoryOptions);
}
function PureWrapperRef() {
_classCallCheck(this, PureWrapperRef);
var ConnectInner = function (_Component) {
_inherits(ConnectInner, _Component);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
function ConnectInner(props) {
_classCallCheck(this, ConnectInner);
PureWrapperRef.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return nextProps.derivedProps !== this.props.derivedProps;
};
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
PureWrapperRef.prototype.render = function render() {
var _props = this.props,
forwardRef = _props.forwardRef,
derivedProps = _props.derivedProps;
_this.state = {
wrapperProps: props.wrapperProps,
store: props.store,
error: null,
childPropsSelector: createChildSelector(props.store),
childProps: {}
return React.createElement(WrappedComponent, _extends({}, derivedProps, { ref: forwardRef }));
};
_this.state = _extends({}, _this.state, ConnectInner.getChildPropsState(props, _this.state));
return _this;
}
return PureWrapperRef;
}(Component);
ConnectInner.getChildPropsState = function getChildPropsState(props, state) {
try {
var childPropsSelector = state.childPropsSelector;
if (props.store !== state.store) {
childPropsSelector = createChildSelector(props.store);
}
var nextProps = childPropsSelector(props.storeState, props.wrapperProps);
if (nextProps === state.childProps) return null;
return { childProps: nextProps, store: props.store, childPropsSelector: childPropsSelector };
} catch (error) {
return { error: error };
}
PureWrapperRef.propTypes = {
derivedProps: propTypes.object,
forwardRef: propTypes.oneOfType([propTypes.func, propTypes.object])
};
PureWrapper = PureWrapperRef;
} else {
var PureWrapperNoRef = function (_Component2) {
_inherits(PureWrapperNoRef, _Component2);
ConnectInner.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var nextChildProps = ConnectInner.getChildPropsState(props, state);
function PureWrapperNoRef() {
_classCallCheck(this, PureWrapperNoRef);
if (nextChildProps === null) {
return null;
return _possibleConstructorReturn(this, _Component2.apply(this, arguments));
}
return _extends({}, nextChildProps, {
wrapperProps: props.wrapperProps
});
};
PureWrapperNoRef.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return nextProps.derivedProps !== this.props.derivedProps;
};
ConnectInner.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
var childPropsChanged = nextState.childProps !== this.state.childProps;
var hasError = !!nextState.error;
PureWrapperNoRef.prototype.render = function render() {
return React.createElement(WrappedComponent, this.props.derivedProps);
};
return childPropsChanged || hasError;
};
return PureWrapperNoRef;
}(Component);
ConnectInner.prototype.render = function render() {
if (this.state.error) {
throw this.state.error;
}
return React.createElement(WrappedComponent, _extends({}, this.state.childProps, { ref: this.props.forwardRef }));
PureWrapperNoRef.propTypes = {
derivedProps: propTypes.object
};
PureWrapper = PureWrapperNoRef;
}
return ConnectInner;
}(Component);
var selectorFactoryOptions = _extends({}, connectOptions, {
getDisplayName: getDisplayName,
methodName: methodName,
renderCountProp: renderCountProp,
shouldHandleStateChanges: shouldHandleStateChanges,
storeKey: storeKey,
displayName: displayName,
wrappedComponentName: wrappedComponentName,
WrappedComponent: WrappedComponent
});
ConnectInner.propTypes = {
wrapperProps: PropTypes.object,
store: storeShape
};
var OuterBase = connectOptions.pure ? PureComponent : Component;
function createWrapperPropsMemoizer() {
var result = void 0,
prevProps = void 0;
var Connect = function (_OuterBase) {
_inherits(Connect, _OuterBase);
return function wrapperPropsMemoizer(props) {
if (props === prevProps) {
return result;
}
function Connect(props) {
_classCallCheck(this, Connect);
var contextConsumer = props.contextConsumer,
forwardRef = props.forwardRef,
wrapperProps = _objectWithoutProperties(props, ['contextConsumer', 'forwardRef']);
var _this3 = _possibleConstructorReturn(this, _OuterBase.call(this, props));
result = { contextConsumer: contextConsumer, forwardRef: forwardRef, wrapperProps: wrapperProps };
invariant(forwardRef ? !props.props[storeKey] : !props[storeKey], 'Passing redux store in props has been removed and does not do anything. ' + 'To use a custom redux store for a single component, ' + 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' + 'and the Consumer to this component\'s connect as in <Provider context={context.Provider}></Provider>' + (' and connect(mapState, mapDispatch, undefined, { consumer=context.consumer })(' + wrappedComponentName + ')'));
_this3.generatedDerivedProps = _this3.makeDerivedPropsGenerator();
_this3.renderWrappedComponent = _this3.renderWrappedComponent.bind(_this3);
return _this3;
}
return result;
Connect.prototype.makeDerivedPropsGenerator = function makeDerivedPropsGenerator() {
var lastProps = void 0;
var lastState = void 0;
var lastDerivedProps = void 0;
var lastStore = void 0;
var sourceSelector = void 0;
return function (state, props, store) {
if (connectOptions.pure && lastProps === props && lastState === state) {
return lastDerivedProps;
}
if (store !== lastStore) {
lastStore = store;
sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions);
}
lastProps = props;
lastState = state;
var nextProps = sourceSelector(state, props);
if (lastDerivedProps === nextProps) {
return lastDerivedProps;
}
lastDerivedProps = nextProps;
return lastDerivedProps;
};
};
}
var Connect = function (_OuterBaseComponent) {
_inherits(Connect, _OuterBaseComponent);
Connect.prototype.renderWrappedComponentWithRef = function renderWrappedComponentWithRef(value) {
invariant(value, 'Could not find "store" in the context of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + 'or pass a custom React context provider to <Provider> and the corresponding ' + ('React context consumer to ' + displayName + ' in connect options.'));
var state = value.state,
store = value.store;
var _props2 = this.props,
forwardRef = _props2.forwardRef,
props = _props2.props;
function Connect(props) {
_classCallCheck(this, Connect);
var derivedProps = this.generatedDerivedProps(state, props, store);
if (connectOptions.pure) {
return React.createElement(PureWrapper, { derivedProps: derivedProps, forwardRef: forwardRef });
}
var _this2 = _possibleConstructorReturn(this, _OuterBaseComponent.call(this, props));
return React.createElement(WrappedComponent, _extends({}, derivedProps, { ref: forwardRef }));
};
_this2.version = version;
Connect.prototype.renderWrappedComponent = function renderWrappedComponent(value) {
invariant(value, 'Could not find "store" in the context of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + 'or pass a custom React context provider to <Provider> and the corresponding ' + ('React context consumer to ' + displayName + ' in connect options.'));
var state = value.state,
store = value.store;
_this2.renderInner = _this2.renderInner.bind(_this2);
var derivedProps = this.generatedDerivedProps(state, this.props, store);
if (connectOptions.pure) {
return React.createElement(PureWrapper, { derivedProps: derivedProps });
}
_this2.wrapperPropsMemoizer = createWrapperPropsMemoizer();
return _this2;
}
Connect.prototype.renderInner = function renderInner(providerValue) {
var storeState = providerValue.storeState,
store = providerValue.store;
var _wrapperPropsMemoizer = this.wrapperPropsMemoizer(this.props),
forwardRef = _wrapperPropsMemoizer.forwardRef,
wrapperProps = _wrapperPropsMemoizer.wrapperProps;
return React.createElement(ConnectInner, {
key: this.version,
storeState: storeState,
store: store,
wrapperProps: wrapperProps,
forwardRef: forwardRef
});
return React.createElement(WrappedComponent, derivedProps);
};
Connect.prototype.render = function render() {
var ContextConsumer = this.props.contextConsumer || consumer;
if (this.props.unstable_observedBits) {
return React.createElement(
Consumer,
{ unstable_observedBits: this.props.unstable_observedBits },
this.renderWrappedComponent
);
}
return React.createElement(
ContextConsumer,
Consumer,
null,
this.renderInner
this.renderWrappedComponent
);

@@ -225,25 +233,27 @@ };

return Connect;
}(OuterBaseComponent);
}(OuterBase);
Connect.WrappedComponent = WrappedComponent;
Connect.displayName = displayName;
Connect.propTypes = {
contextConsumer: PropTypes.object,
forwardRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
// TODO We're losing the ability to add a store as a prop. Not sure there's anything we can do about that.
};var wrapperComponent = Connect;
if (forwardRef) {
var forwarded = React.forwardRef(function (props, ref) {
return React.createElement(Connect, _extends({}, props, { forwardRef: ref }));
});
Connect.prototype.renderWrappedComponent = Connect.prototype.renderWrappedComponentWithRef;
Connect.propTypes = {
props: propTypes.object,
forwardRef: propTypes.oneOfType([propTypes.func, propTypes.object])
};
}
wrapperComponent = forwarded;
if (!forwardRef) {
return hoistStatics(Connect, WrappedComponent);
}
return hoistStatics(wrapperComponent, WrappedComponent);
function forwardRef(props, ref) {
return React.createElement(Connect, { props: props, forwardRef: ref });
}
var forwarded = React.forwardRef(forwardRef);
forwarded.displayName = displayName;
forwarded.WrappedComponent = WrappedComponent;
return hoistStatics(forwarded, WrappedComponent);
};
}

@@ -7,109 +7,88 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

import React, { Component, Children } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { storeShape } from '../utils/PropTypes';
import warning from '../utils/warning';
import Context from './Context';
import { ReactReduxContext } from "./context";
var ContextProvider = Context.Provider;
var didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
didWarnAboutReceivingStore = true;
var Provider = function (_Component) {
_inherits(Provider, _Component);
warning('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reduxjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}
function Provider(props) {
_classCallCheck(this, Provider);
export function createProvider() {
var Provider = function (_Component) {
_inherits(Provider, _Component);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
function Provider(props) {
_classCallCheck(this, Provider);
_this.state = {
state: props.store.getState(),
store: props.store
};
_this.unsubscribe = null;
return _this;
}
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
Provider.prototype.componentDidMount = function componentDidMount() {
this.isUnmounted = false;
var state = this.state.store.getState();
this.unsubscribe = this.state.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this));
var store = props.store;
_this.state = {
storeState: store.getState(),
store: store
};
return _this;
if (state !== this.state.state) {
this.setState({ state: state });
}
};
Provider.prototype.componentDidMount = function componentDidMount() {
this._isMounted = true;
this.subscribe();
};
Provider.prototype.componentWillUnmount = function componentWillUnmount() {
this.isUnmounted = true;
if (this.unsubscribe) this.unsubscribe();
};
Provider.prototype.componentWillUnmount = function componentWillUnmount() {
Provider.prototype.componentDidUpdate = function componentDidUpdate(lastProps) {
if (lastProps.store !== this.props.store) {
if (this.unsubscribe) this.unsubscribe();
this.unsubscribe = this.props.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this));
this.setState({
state: this.props.store.getState(),
store: this.props.store
});
}
};
this._isMounted = false;
};
Provider.prototype.triggerUpdateOnStoreStateChange = function triggerUpdateOnStoreStateChange() {
if (this.isUnmounted) {
return;
}
Provider.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.store !== prevProps.store) {
if (this.unsubscribe) this.unsubscribe();
this.subscribe();
this.setState(function (prevState) {
var newState = prevState.store.getState();
if (prevState.state === newState) {
return null;
}
};
return {
state: newState
};
});
};
Provider.prototype.subscribe = function subscribe() {
var _this2 = this;
var store = this.props.store;
this.unsubscribe = store.subscribe(function () {
var newStoreState = store.getState();
if (!_this2._isMounted) {
return;
}
_this2.setState(function (providerState) {
// If the value is the same, skip the unnecessary state update.
if (providerState.storeState === newStoreState) {
return null;
}
return { storeState: newStoreState };
});
});
// Actions might have been dispatched between render and mount - handle those
var postMountStoreState = store.getState();
if (postMountStoreState !== this.state.storeState) {
this.setState({ storeState: postMountStoreState });
}
};
Provider.prototype.render = function render() {
var ContextProvider = this.props.contextProvider || ReactReduxContext.Provider;
return React.createElement(
ContextProvider,
{ value: this.state },
this.props.children
);
};
return Provider;
}(Component);
Provider.propTypes = {
store: storeShape.isRequired,
children: PropTypes.element.isRequired,
contextProvider: PropTypes.object
Provider.prototype.render = function render() {
var Context = this.props.context || ContextProvider;
return React.createElement(
Context,
{ value: this.state },
this.props.children
);
};
return Provider;
}
}(Component);
export default createProvider();
Provider.propTypes = {
store: PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
}),
context: PropTypes.object,
children: PropTypes.any
};
export default Provider;

@@ -1,5 +0,6 @@

import Provider, { createProvider } from './components/Provider';
import Provider from './components/Provider';
import connectAdvanced from './components/connectAdvanced';
import Context from './components/Context';
import connect from './connect/connect';
export { Provider, createProvider, connectAdvanced, connect };
export { Provider, connectAdvanced, Context, connect };

@@ -17,2 +17,6 @@ 'use strict';

var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');

@@ -22,11 +26,7 @@

var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactIs = require('react-is');
var _context = require('./context');
var _Context = require('./Context');
var _PropTypes = require('../utils/PropTypes');
var _Context2 = _interopRequireDefault(_Context);

@@ -43,3 +43,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var hotReloadingVersion = 0;
var ReduxConsumer = _Context2.default.Consumer;

@@ -69,6 +69,6 @@ function connectAdvanced(

methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName,
_ref$renderCountProp = _ref.renderCountProp,
renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp,
_ref$shouldHandleStat = _ref.shouldHandleStateChanges,
shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat,
_ref$consumer = _ref.consumer,
consumer = _ref$consumer === undefined ? _context.ReactReduxContext.Consumer : _ref$consumer,
_ref$storeKey = _ref.storeKey,

@@ -80,9 +80,13 @@ storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey,

forwardRef = _ref$forwardRef === undefined ? false : _ref$forwardRef,
connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'shouldHandleStateChanges', 'consumer', 'storeKey', 'withRef', 'forwardRef']);
_ref$consumer = _ref.consumer,
consumer = _ref$consumer === undefined ? ReduxConsumer : _ref$consumer,
connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef', 'forwardRef', 'consumer']);
(0, _invariant2.default)(renderCountProp === undefined, 'renderCountProp is removed. render counting is built into the latest React dev tools profiling extension');
(0, _invariant2.default)(!withRef, "withRef is removed. To access the wrapped instance, use a ref on the connected component");
(0, _invariant2.default)(storeKey === 'store', 'storeKey has been removed. To use a custom redux store for a single component, ' + 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' + 'and the Consumer to this component as in <Provider context={context.Provider}><' + 'ConnectedComponent consumer={context.Consumer} /></Provider>');
(0, _invariant2.default)(storeKey === 'store', 'storeKey has been removed and does not do anything. To use a custom redux store for a single component, ' + 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' + 'and the Consumer to this component as in <Provider context={context.Provider}><' + 'ConnectedComponent consumer={context.Consumer} /></Provider>');
var version = hotReloadingVersion++;
var Consumer = consumer;

@@ -96,149 +100,154 @@ return function wrapWithConnect(WrappedComponent) {

var selectorFactoryOptions = _extends({}, connectOptions, {
getDisplayName: getDisplayName,
methodName: methodName,
shouldHandleStateChanges: shouldHandleStateChanges,
displayName: displayName,
wrappedComponentName: wrappedComponentName,
WrappedComponent: WrappedComponent
});
var PureWrapper = void 0;
var OuterBaseComponent = connectOptions.pure ? _react.PureComponent : _react.Component;
if (forwardRef) {
var PureWrapperRef = function (_Component) {
_inherits(PureWrapperRef, _Component);
function createChildSelector(store) {
return selectorFactory(store.dispatch, selectorFactoryOptions);
}
function PureWrapperRef() {
_classCallCheck(this, PureWrapperRef);
var ConnectInner = function (_Component) {
_inherits(ConnectInner, _Component);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
function ConnectInner(props) {
_classCallCheck(this, ConnectInner);
PureWrapperRef.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return nextProps.derivedProps !== this.props.derivedProps;
};
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
PureWrapperRef.prototype.render = function render() {
var _props = this.props,
forwardRef = _props.forwardRef,
derivedProps = _props.derivedProps;
_this.state = {
wrapperProps: props.wrapperProps,
store: props.store,
error: null,
childPropsSelector: createChildSelector(props.store),
childProps: {}
return _react2.default.createElement(WrappedComponent, _extends({}, derivedProps, { ref: forwardRef }));
};
_this.state = _extends({}, _this.state, ConnectInner.getChildPropsState(props, _this.state));
return _this;
}
return PureWrapperRef;
}(_react.Component);
ConnectInner.getChildPropsState = function getChildPropsState(props, state) {
try {
var childPropsSelector = state.childPropsSelector;
if (props.store !== state.store) {
childPropsSelector = createChildSelector(props.store);
}
var nextProps = childPropsSelector(props.storeState, props.wrapperProps);
if (nextProps === state.childProps) return null;
return { childProps: nextProps, store: props.store, childPropsSelector: childPropsSelector };
} catch (error) {
return { error: error };
}
PureWrapperRef.propTypes = {
derivedProps: _propTypes2.default.object,
forwardRef: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.object])
};
PureWrapper = PureWrapperRef;
} else {
var PureWrapperNoRef = function (_Component2) {
_inherits(PureWrapperNoRef, _Component2);
ConnectInner.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var nextChildProps = ConnectInner.getChildPropsState(props, state);
function PureWrapperNoRef() {
_classCallCheck(this, PureWrapperNoRef);
if (nextChildProps === null) {
return null;
return _possibleConstructorReturn(this, _Component2.apply(this, arguments));
}
return _extends({}, nextChildProps, {
wrapperProps: props.wrapperProps
});
};
PureWrapperNoRef.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return nextProps.derivedProps !== this.props.derivedProps;
};
ConnectInner.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
var childPropsChanged = nextState.childProps !== this.state.childProps;
var hasError = !!nextState.error;
PureWrapperNoRef.prototype.render = function render() {
return _react2.default.createElement(WrappedComponent, this.props.derivedProps);
};
return childPropsChanged || hasError;
};
return PureWrapperNoRef;
}(_react.Component);
ConnectInner.prototype.render = function render() {
if (this.state.error) {
throw this.state.error;
}
return _react2.default.createElement(WrappedComponent, _extends({}, this.state.childProps, { ref: this.props.forwardRef }));
PureWrapperNoRef.propTypes = {
derivedProps: _propTypes2.default.object
};
PureWrapper = PureWrapperNoRef;
}
return ConnectInner;
}(_react.Component);
var selectorFactoryOptions = _extends({}, connectOptions, {
getDisplayName: getDisplayName,
methodName: methodName,
renderCountProp: renderCountProp,
shouldHandleStateChanges: shouldHandleStateChanges,
storeKey: storeKey,
displayName: displayName,
wrappedComponentName: wrappedComponentName,
WrappedComponent: WrappedComponent
});
ConnectInner.propTypes = {
wrapperProps: _propTypes2.default.object,
store: _PropTypes.storeShape
};
var OuterBase = connectOptions.pure ? _react.PureComponent : _react.Component;
function createWrapperPropsMemoizer() {
var result = void 0,
prevProps = void 0;
var Connect = function (_OuterBase) {
_inherits(Connect, _OuterBase);
return function wrapperPropsMemoizer(props) {
if (props === prevProps) {
return result;
}
function Connect(props) {
_classCallCheck(this, Connect);
var contextConsumer = props.contextConsumer,
forwardRef = props.forwardRef,
wrapperProps = _objectWithoutProperties(props, ['contextConsumer', 'forwardRef']);
var _this3 = _possibleConstructorReturn(this, _OuterBase.call(this, props));
result = { contextConsumer: contextConsumer, forwardRef: forwardRef, wrapperProps: wrapperProps };
(0, _invariant2.default)(forwardRef ? !props.props[storeKey] : !props[storeKey], 'Passing redux store in props has been removed and does not do anything. ' + 'To use a custom redux store for a single component, ' + 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' + 'and the Consumer to this component\'s connect as in <Provider context={context.Provider}></Provider>' + (' and connect(mapState, mapDispatch, undefined, { consumer=context.consumer })(' + wrappedComponentName + ')'));
_this3.generatedDerivedProps = _this3.makeDerivedPropsGenerator();
_this3.renderWrappedComponent = _this3.renderWrappedComponent.bind(_this3);
return _this3;
}
return result;
Connect.prototype.makeDerivedPropsGenerator = function makeDerivedPropsGenerator() {
var lastProps = void 0;
var lastState = void 0;
var lastDerivedProps = void 0;
var lastStore = void 0;
var sourceSelector = void 0;
return function (state, props, store) {
if (connectOptions.pure && lastProps === props && lastState === state) {
return lastDerivedProps;
}
if (store !== lastStore) {
lastStore = store;
sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions);
}
lastProps = props;
lastState = state;
var nextProps = sourceSelector(state, props);
if (lastDerivedProps === nextProps) {
return lastDerivedProps;
}
lastDerivedProps = nextProps;
return lastDerivedProps;
};
};
}
var Connect = function (_OuterBaseComponent) {
_inherits(Connect, _OuterBaseComponent);
Connect.prototype.renderWrappedComponentWithRef = function renderWrappedComponentWithRef(value) {
(0, _invariant2.default)(value, 'Could not find "store" in the context of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + 'or pass a custom React context provider to <Provider> and the corresponding ' + ('React context consumer to ' + displayName + ' in connect options.'));
var state = value.state,
store = value.store;
var _props2 = this.props,
forwardRef = _props2.forwardRef,
props = _props2.props;
function Connect(props) {
_classCallCheck(this, Connect);
var derivedProps = this.generatedDerivedProps(state, props, store);
if (connectOptions.pure) {
return _react2.default.createElement(PureWrapper, { derivedProps: derivedProps, forwardRef: forwardRef });
}
var _this2 = _possibleConstructorReturn(this, _OuterBaseComponent.call(this, props));
return _react2.default.createElement(WrappedComponent, _extends({}, derivedProps, { ref: forwardRef }));
};
_this2.version = version;
Connect.prototype.renderWrappedComponent = function renderWrappedComponent(value) {
(0, _invariant2.default)(value, 'Could not find "store" in the context of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + 'or pass a custom React context provider to <Provider> and the corresponding ' + ('React context consumer to ' + displayName + ' in connect options.'));
var state = value.state,
store = value.store;
_this2.renderInner = _this2.renderInner.bind(_this2);
var derivedProps = this.generatedDerivedProps(state, this.props, store);
if (connectOptions.pure) {
return _react2.default.createElement(PureWrapper, { derivedProps: derivedProps });
}
_this2.wrapperPropsMemoizer = createWrapperPropsMemoizer();
return _this2;
}
Connect.prototype.renderInner = function renderInner(providerValue) {
var storeState = providerValue.storeState,
store = providerValue.store;
var _wrapperPropsMemoizer = this.wrapperPropsMemoizer(this.props),
forwardRef = _wrapperPropsMemoizer.forwardRef,
wrapperProps = _wrapperPropsMemoizer.wrapperProps;
return _react2.default.createElement(ConnectInner, {
key: this.version,
storeState: storeState,
store: store,
wrapperProps: wrapperProps,
forwardRef: forwardRef
});
return _react2.default.createElement(WrappedComponent, derivedProps);
};
Connect.prototype.render = function render() {
var ContextConsumer = this.props.contextConsumer || consumer;
if (this.props.unstable_observedBits) {
return _react2.default.createElement(
Consumer,
{ unstable_observedBits: this.props.unstable_observedBits },
this.renderWrappedComponent
);
}
return _react2.default.createElement(
ContextConsumer,
Consumer,
null,
this.renderInner
this.renderWrappedComponent
);

@@ -248,25 +257,27 @@ };

return Connect;
}(OuterBaseComponent);
}(OuterBase);
Connect.WrappedComponent = WrappedComponent;
Connect.displayName = displayName;
Connect.propTypes = {
contextConsumer: _propTypes2.default.object,
forwardRef: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.object])
// TODO We're losing the ability to add a store as a prop. Not sure there's anything we can do about that.
};var wrapperComponent = Connect;
if (forwardRef) {
var forwarded = _react2.default.forwardRef(function (props, ref) {
return _react2.default.createElement(Connect, _extends({}, props, { forwardRef: ref }));
});
Connect.prototype.renderWrappedComponent = Connect.prototype.renderWrappedComponentWithRef;
Connect.propTypes = {
props: _propTypes2.default.object,
forwardRef: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.object])
};
}
wrapperComponent = forwarded;
if (!forwardRef) {
return (0, _hoistNonReactStatics2.default)(Connect, WrappedComponent);
}
return (0, _hoistNonReactStatics2.default)(wrapperComponent, WrappedComponent);
function forwardRef(props, ref) {
return _react2.default.createElement(Connect, { props: props, forwardRef: ref });
}
var forwarded = _react2.default.forwardRef(forwardRef);
forwarded.displayName = displayName;
forwarded.WrappedComponent = WrappedComponent;
return (0, _hoistNonReactStatics2.default)(forwarded, WrappedComponent);
};
}
'use strict';
exports.__esModule = true;
exports.createProvider = createProvider;

@@ -14,10 +13,6 @@ var _react = require('react');

var _PropTypes = require('../utils/PropTypes');
var _Context = require('./Context');
var _warning = require('../utils/warning');
var _Context2 = _interopRequireDefault(_Context);
var _warning2 = _interopRequireDefault(_warning);
var _context = require('./context');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -31,102 +26,84 @@

var didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
didWarnAboutReceivingStore = true;
var ContextProvider = _Context2.default.Provider;
(0, _warning2.default)('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reduxjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}
var Provider = function (_Component) {
_inherits(Provider, _Component);
function createProvider() {
var Provider = function (_Component) {
_inherits(Provider, _Component);
function Provider(props) {
_classCallCheck(this, Provider);
function Provider(props) {
_classCallCheck(this, Provider);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
_this.state = {
state: props.store.getState(),
store: props.store
};
_this.unsubscribe = null;
return _this;
}
var store = props.store;
Provider.prototype.componentDidMount = function componentDidMount() {
this.isUnmounted = false;
var state = this.state.store.getState();
this.unsubscribe = this.state.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this));
_this.state = {
storeState: store.getState(),
store: store
};
return _this;
if (state !== this.state.state) {
this.setState({ state: state });
}
};
Provider.prototype.componentDidMount = function componentDidMount() {
this._isMounted = true;
this.subscribe();
};
Provider.prototype.componentWillUnmount = function componentWillUnmount() {
this.isUnmounted = true;
if (this.unsubscribe) this.unsubscribe();
};
Provider.prototype.componentWillUnmount = function componentWillUnmount() {
Provider.prototype.componentDidUpdate = function componentDidUpdate(lastProps) {
if (lastProps.store !== this.props.store) {
if (this.unsubscribe) this.unsubscribe();
this.unsubscribe = this.props.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this));
this.setState({
state: this.props.store.getState(),
store: this.props.store
});
}
};
this._isMounted = false;
};
Provider.prototype.triggerUpdateOnStoreStateChange = function triggerUpdateOnStoreStateChange() {
if (this.isUnmounted) {
return;
}
Provider.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.store !== prevProps.store) {
if (this.unsubscribe) this.unsubscribe();
this.subscribe();
this.setState(function (prevState) {
var newState = prevState.store.getState();
if (prevState.state === newState) {
return null;
}
};
return {
state: newState
};
});
};
Provider.prototype.subscribe = function subscribe() {
var _this2 = this;
var store = this.props.store;
this.unsubscribe = store.subscribe(function () {
var newStoreState = store.getState();
if (!_this2._isMounted) {
return;
}
_this2.setState(function (providerState) {
// If the value is the same, skip the unnecessary state update.
if (providerState.storeState === newStoreState) {
return null;
}
return { storeState: newStoreState };
});
});
// Actions might have been dispatched between render and mount - handle those
var postMountStoreState = store.getState();
if (postMountStoreState !== this.state.storeState) {
this.setState({ storeState: postMountStoreState });
}
};
Provider.prototype.render = function render() {
var ContextProvider = this.props.contextProvider || _context.ReactReduxContext.Provider;
return _react2.default.createElement(
ContextProvider,
{ value: this.state },
this.props.children
);
};
return Provider;
}(_react.Component);
Provider.propTypes = {
store: _PropTypes.storeShape.isRequired,
children: _propTypes2.default.element.isRequired,
contextProvider: _propTypes2.default.object
Provider.prototype.render = function render() {
var Context = this.props.context || ContextProvider;
return _react2.default.createElement(
Context,
{ value: this.state },
this.props.children
);
};
return Provider;
}
}(_react.Component);
exports.default = createProvider();
Provider.propTypes = {
store: _propTypes2.default.shape({
subscribe: _propTypes2.default.func.isRequired,
dispatch: _propTypes2.default.func.isRequired,
getState: _propTypes2.default.func.isRequired
}),
context: _propTypes2.default.object,
children: _propTypes2.default.any
};
exports.default = Provider;
'use strict';
exports.__esModule = true;
exports.connect = exports.connectAdvanced = exports.createProvider = exports.Provider = undefined;
exports.connect = exports.Context = exports.connectAdvanced = exports.Provider = undefined;

@@ -14,2 +14,6 @@ var _Provider = require('./components/Provider');

var _Context = require('./components/Context');
var _Context2 = _interopRequireDefault(_Context);
var _connect = require('./connect/connect');

@@ -22,4 +26,4 @@

exports.Provider = _Provider2.default;
exports.createProvider = _Provider.createProvider;
exports.connectAdvanced = _connectAdvanced2.default;
exports.Context = _Context2.default;
exports.connect = _connect2.default;
{
"name": "react-redux",
"version": "6.0.0-alpha.9210282",
"version": "6.0.0-alpha.2a2f108",
"description": "Official React bindings for Redux",

@@ -42,12 +42,12 @@ "keywords": [

"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0",
"react": "^16.4.0-0",
"redux": "^2.0.0 || ^3.0.0 || ^4.0.0-0"
},
"dependencies": {
"hoist-non-react-statics": "^2.5.5",
"hoist-non-react-statics": "^3.0.1",
"invariant": "^2.2.4",
"loose-envify": "^1.1.0",
"prop-types": "^15.6.1",
"prop-types": "^15.6.2",
"react-is": "^16.4.2",
"react-lifecycles-compat": "^3.0.0"
"shallow-equals": "^1.0.0"
},

@@ -82,2 +82,3 @@ "devDependencies": {

"babel-plugin-transform-react-jsx": "^6.4.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
"codecov": "^3.0.2",

@@ -84,0 +85,0 @@ "create-react-class": "^15.6.3",

import hoistStatics from 'hoist-non-react-statics'
import invariant from 'invariant'
import PropTypes from 'prop-types'
import React, { Component, PureComponent } from 'react'
import propTypes from 'prop-types'
import { isValidElementType } from 'react-is'
import {ReactReduxContext} from "./context"
import {storeShape} from "../utils/PropTypes"
import Context from './Context'
let hotReloadingVersion = 0
const ReduxConsumer = Context.Consumer
export default function connectAdvanced(

@@ -42,10 +40,10 @@ /*

// if defined, the name of the property passed to the wrapped element indicating the number of
// calls to render. useful for watching in react devtools for unnecessary re-renders.
renderCountProp = undefined,
// determines whether this HOC subscribes to store changes
shouldHandleStateChanges = true,
// the context consumer to use
consumer = ReactReduxContext.Consumer,
// REMOVED: the key of props/context to get the store
// the key of props/context to get the store [**does nothing, use consumer**]
storeKey = 'store',

@@ -59,2 +57,5 @@

// the context consumer to use
consumer = ReduxConsumer,
// additional options are passed through to the selectorFactory

@@ -64,2 +65,6 @@ ...connectOptions

) {
invariant(renderCountProp === undefined,
`renderCountProp is removed. render counting is built into the latest React dev tools profiling extension`
)
invariant(!withRef,

@@ -70,3 +75,3 @@ "withRef is removed. To access the wrapped instance, use a ref on the connected component"

invariant(storeKey === 'store',
'storeKey has been removed. To use a custom redux store for a single component, ' +
'storeKey has been removed and does not do anything. To use a custom redux store for a single component, ' +
'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' +

@@ -77,6 +82,4 @@ 'and the Consumer to this component as in <Provider context={context.Provider}><' +

const Consumer = consumer
const version = hotReloadingVersion++
return function wrapWithConnect(WrappedComponent) {

@@ -95,2 +98,39 @@ invariant(

let PureWrapper
if (forwardRef) {
class PureWrapperRef extends Component {
shouldComponentUpdate(nextProps) {
return nextProps.derivedProps !== this.props.derivedProps
}
render() {
let { forwardRef, derivedProps } = this.props
return <WrappedComponent {...derivedProps} ref={forwardRef} />
}
}
PureWrapperRef.propTypes = {
derivedProps: propTypes.object,
forwardRef: propTypes.oneOfType([
propTypes.func,
propTypes.object
])
}
PureWrapper = PureWrapperRef
} else {
class PureWrapperNoRef extends Component {
shouldComponentUpdate(nextProps) {
return nextProps.derivedProps !== this.props.derivedProps
}
render() {
return <WrappedComponent {...this.props.derivedProps} />
}
}
PureWrapperNoRef.propTypes = {
derivedProps: propTypes.object,
}
PureWrapper = PureWrapperNoRef
}
const selectorFactoryOptions = {

@@ -100,3 +140,5 @@ ...connectOptions,

methodName,
renderCountProp,
shouldHandleStateChanges,
storeKey,
displayName,

@@ -107,130 +149,88 @@ wrappedComponentName,

const OuterBase = connectOptions.pure ? PureComponent : Component
const OuterBaseComponent = connectOptions.pure ? PureComponent : Component
function createChildSelector(store) {
return selectorFactory(store.dispatch, selectorFactoryOptions)
}
class ConnectInner extends Component {
class Connect extends OuterBase {
constructor(props) {
super(props)
this.state = {
wrapperProps : props.wrapperProps,
store : props.store,
error : null,
childPropsSelector : createChildSelector(props.store),
childProps : {},
}
this.state = {
...this.state,
...ConnectInner.getChildPropsState(props, this.state)
}
invariant(forwardRef ? !props.props[storeKey] : !props[storeKey],
'Passing redux store in props has been removed and does not do anything. ' +
'To use a custom redux store for a single component, ' +
'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' +
'and the Consumer to this component\'s connect as in <Provider context={context.Provider}></Provider>' +
` and connect(mapState, mapDispatch, undefined, { consumer=context.consumer })(${wrappedComponentName})`
)
this.generatedDerivedProps = this.makeDerivedPropsGenerator()
this.renderWrappedComponent = this.renderWrappedComponent.bind(this)
}
static getChildPropsState(props, state) {
try {
let {childPropsSelector} = state
if(props.store !== state.store) {
childPropsSelector = createChildSelector(props.store)
makeDerivedPropsGenerator() {
let lastProps
let lastState
let lastDerivedProps
let lastStore
let sourceSelector
return (state, props, store) => {
if ((connectOptions.pure && lastProps === props) && (lastState === state)) {
return lastDerivedProps
}
const nextProps = childPropsSelector(props.storeState, props.wrapperProps)
if (nextProps === state.childProps) return null
return { childProps: nextProps, store : props.store, childPropsSelector }
} catch (error) {
return { error }
if (store !== lastStore) {
lastStore = store
sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions)
}
lastProps = props
lastState = state
const nextProps = sourceSelector(state, props)
if (lastDerivedProps === nextProps) {
return lastDerivedProps
}
lastDerivedProps = nextProps
return lastDerivedProps
}
}
static getDerivedStateFromProps(props, state) {
const nextChildProps = ConnectInner.getChildPropsState(props, state)
if(nextChildProps === null) {
return null
renderWrappedComponentWithRef(value) {
invariant(value,
`Could not find "store" in the context of ` +
`"${displayName}". Either wrap the root component in a <Provider>, ` +
`or pass a custom React context provider to <Provider> and the corresponding ` +
`React context consumer to ${displayName} in connect options.`
)
const { state, store } = value
const { forwardRef, props } = this.props
let derivedProps = this.generatedDerivedProps(state, props, store)
if (connectOptions.pure) {
return <PureWrapper derivedProps={derivedProps} forwardRef={forwardRef} />
}
return {
...nextChildProps,
wrapperProps : props.wrapperProps,
}
return <WrappedComponent {...derivedProps} ref={forwardRef} />
}
shouldComponentUpdate(nextProps, nextState) {
const childPropsChanged = nextState.childProps !== this.state.childProps
const hasError = !!nextState.error
renderWrappedComponent(value) {
invariant(value,
`Could not find "store" in the context of ` +
`"${displayName}". Either wrap the root component in a <Provider>, ` +
`or pass a custom React context provider to <Provider> and the corresponding ` +
`React context consumer to ${displayName} in connect options.`
)
const { state, store } = value
let derivedProps = this.generatedDerivedProps(state, this.props, store)
if (connectOptions.pure) {
return <PureWrapper derivedProps={derivedProps} />
}
return childPropsChanged || hasError
return <WrappedComponent {...derivedProps} />
}
render() {
if(this.state.error) {
throw this.state.error
}
return <WrappedComponent {...this.state.childProps} ref={this.props.forwardRef} />
}
}
ConnectInner.propTypes = {
wrapperProps : PropTypes.object,
store : storeShape,
}
function createWrapperPropsMemoizer() {
let result, prevProps
return function wrapperPropsMemoizer(props) {
if(props === prevProps) {
return result
}
const {contextConsumer, forwardRef, ...wrapperProps} = props
result = {contextConsumer, forwardRef, wrapperProps}
return result
}
}
class Connect extends OuterBaseComponent {
constructor(props) {
super(props)
this.version = version
this.renderInner = this.renderInner.bind(this)
this.wrapperPropsMemoizer = createWrapperPropsMemoizer()
}
renderInner(providerValue) {
const {storeState, store} = providerValue
const {forwardRef, wrapperProps} = this.wrapperPropsMemoizer(this.props)
if (this.props.unstable_observedBits) {
return (
<ConnectInner
key={this.version}
storeState={storeState}
store={store}
wrapperProps={wrapperProps}
forwardRef={forwardRef}
/>
<Consumer unstable_observedBits={this.props.unstable_observedBits}>
{this.renderWrappedComponent}
</Consumer>
)
}
render() {
const ContextConsumer = this.props.contextConsumer || consumer
}
return (
<ContextConsumer>
{this.renderInner}
</ContextConsumer>
<Consumer>
{this.renderWrappedComponent}
</Consumer>
)

@@ -242,25 +242,26 @@ }

Connect.displayName = displayName
Connect.propTypes = {
contextConsumer: PropTypes.object,
forwardRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.object
])
if (forwardRef) {
Connect.prototype.renderWrappedComponent = Connect.prototype.renderWrappedComponentWithRef
Connect.propTypes = {
props: propTypes.object,
forwardRef: propTypes.oneOfType([
propTypes.func,
propTypes.object
])
}
}
// TODO We're losing the ability to add a store as a prop. Not sure there's anything we can do about that.
if (!forwardRef) {
return hoistStatics(Connect, WrappedComponent)
}
let wrapperComponent = Connect
if(forwardRef) {
const forwarded = React.forwardRef(function (props, ref) {
return <Connect {...props} forwardRef={ref} />
})
wrapperComponent = forwarded
function forwardRef(props, ref) {
return <Connect props={props} forwardRef={ref} />
}
return hoistStatics(wrapperComponent, WrappedComponent)
const forwarded = React.forwardRef(forwardRef)
forwarded.displayName = displayName
forwarded.WrappedComponent = WrappedComponent
return hoistStatics(forwarded, WrappedComponent)
}
}

@@ -1,106 +0,79 @@

import React, { Component, Children } from 'react'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { storeShape } from '../utils/PropTypes'
import warning from '../utils/warning'
import Context from './Context'
import {ReactReduxContext} from "./context"
const ContextProvider = Context.Provider
let didWarnAboutReceivingStore = false
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return
class Provider extends Component {
constructor(props) {
super(props)
this.state = {
state: props.store.getState(),
store: props.store
}
this.unsubscribe = null
}
didWarnAboutReceivingStore = true
warning(
'<Provider> does not support changing `store` on the fly. ' +
'It is most likely that you see this error because you updated to ' +
'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' +
'automatically. See https://github.com/reduxjs/react-redux/releases/' +
'tag/v2.0.0 for the migration instructions.'
)
}
componentDidMount() {
this.isUnmounted = false
const state = this.state.store.getState()
this.unsubscribe = this.state.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this))
export function createProvider() {
if (state !== this.state.state) {
this.setState({ state })
}
}
class Provider extends Component {
componentWillUnmount() {
this.isUnmounted = true
if (this.unsubscribe) this.unsubscribe()
}
constructor(props) {
super(props)
componentDidUpdate(lastProps) {
if (lastProps.store !== this.props.store) {
if (this.unsubscribe) this.unsubscribe()
this.unsubscribe = this.props.store.subscribe(this.triggerUpdateOnStoreStateChange.bind(this))
this.setState({
state: this.props.store.getState(),
store: this.props.store
})
}
}
const {store} = props
this.state = {
storeState : store.getState(),
store,
}
}
componentDidMount() {
this._isMounted = true
this.subscribe()
}
componentWillUnmount() {
if(this.unsubscribe) this.unsubscribe()
this._isMounted = false
}
componentDidUpdate(prevProps) {
if(this.props.store !== prevProps.store) {
if(this.unsubscribe) this.unsubscribe()
this.subscribe()
}
}
subscribe() {
const {store} = this.props
this.unsubscribe = store.subscribe( () => {
const newStoreState = store.getState()
if(!this._isMounted) {
return
}
this.setState(providerState => {
// If the value is the same, skip the unnecessary state update.
if(providerState.storeState === newStoreState) {
return null
}
return {storeState : newStoreState}
})
})
// Actions might have been dispatched between render and mount - handle those
const postMountStoreState = store.getState()
if(postMountStoreState !== this.state.storeState) {
this.setState({storeState : postMountStoreState})
}
}
render() {
const ContextProvider = this.props.contextProvider || ReactReduxContext.Provider
return (
<ContextProvider value={this.state}>
{this.props.children}
</ContextProvider>
)
}
triggerUpdateOnStoreStateChange() {
if (this.isUnmounted) {
return
}
this.setState(prevState => {
const newState = prevState.store.getState()
if (prevState.state === newState) {
return null
}
return {
state: newState
}
})
}
Provider.propTypes = {
store: storeShape.isRequired,
children: PropTypes.element.isRequired,
contextProvider : PropTypes.object,
}
render() {
const Context = this.props.context || ContextProvider
return (
<Context value={this.state}>
{this.props.children}
</Context>
)
}
}
return Provider
Provider.propTypes = {
store: PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
}),
context: PropTypes.object,
children: PropTypes.any
}
export default createProvider()
export default Provider

@@ -1,5 +0,6 @@

import Provider, { createProvider } from './components/Provider'
import Provider from './components/Provider'
import connectAdvanced from './components/connectAdvanced'
import Context from './components/Context'
import connect from './connect/connect'
export { Provider, createProvider, connectAdvanced, connect }
export { Provider, connectAdvanced, Context, connect }

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc