Socket
Socket
Sign inDemoInstall

react-redux

Package Overview
Dependencies
2
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

2

dist/react-redux.js

@@ -232,2 +232,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

if (!pure) {
this.updateStateProps(nextProps);
this.updateDispatchProps(nextProps);
this.updateState(nextProps);

@@ -234,0 +236,0 @@ return true;

2

dist/react-redux.min.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(9),u=n(o),i=r(2),s=n(i),a=s.default(u.default),c=a.Provider,p=a.connect;e.Provider=c,e.connect=p},function(t,e){"use strict";function r(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=i.default(t),r=a.default(t);return{Provider:e,connect:r}}e.__esModule=!0,e.default=o;var u=r(4),i=n(u),s=r(3),a=n(s);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return t.displayName||t.name||"Component"}function s(t){var e=t.Component,r=t.PropTypes,n=f.default(r);return function(r,s,p){function f(t,e){var r=t.getState(),n=R?S(r,e):S(r);return g.default(y.default(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function l(t,e){var r=t.dispatch,n=C?j(r,e):j(r);return g.default(y.default(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function h(t,e,r){var n=O(t,e,r);return g.default(y.default(n),"`mergeProps` must return an object. Instead received %s.",n),n}var b=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],m=Boolean(r),S=r||x,j=y.default(s)?v.default(s):s||P,O=p||_,R=S.length>1,C=j.length>1,M=b.pure,T=void 0===M?!0:M,k=w++;return function(r){var s=function(e){function s(t,r){o(this,s),e.call(this,t,r),this.version=k,this.store=t.store||r.store,g.default(this.store,'Could not find "store" in either the context or '+('props of "'+this.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+this.constructor.displayName+'".')),this.stateProps=f(this.store,t),this.dispatchProps=l(this.store,t),this.state={storeState:null},this.updateState()}return u(s,e),s.prototype.shouldComponentUpdate=function(t,e){if(!T)return this.updateState(t),!0;var r=e.storeState!==this.state.storeState,n=!d.default(t,this.props),o=!1,u=!1;return(r||n&&R)&&(o=this.updateStateProps(t)),n&&C&&(u=this.updateDispatchProps(t)),n||o||u?(this.updateState(t),!0):!1},a(s,null,[{key:"displayName",value:"Connect("+i(r)+")",enumerable:!0},{key:"WrappedComponent",value:r,enumerable:!0},{key:"contextTypes",value:{store:n},enumerable:!0},{key:"propTypes",value:{store:n},enumerable:!0}]),s.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return h(this.stateProps,this.dispatchProps,t)},s.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=f(this.store,t);return d.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},s.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=l(this.store,t);return d.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},s.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];this.nextState=this.computeNextState(t)},s.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},s.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},s.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},s.prototype.componentDidMount=function(){this.trySubscribe()},s.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},s.prototype.handleChange=function(){this.unsubscribe&&this.setState({storeState:this.store.getState()})},s.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},s.prototype.render=function(){return t.createElement(r,c({ref:"wrappedInstance"},this.nextState))},s}(e);return s}}}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=s;var p=r(1),f=n(p),l=r(6),d=n(l),h=r(5),y=n(h),b=r(7),v=n(b),m=r(8),g=n(m),x=function(){return{}},P=function(t){return{dispatch:t}},_=function(t,e,r){return c({},r,t,e)},w=0;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){var e=t.version;if("string"!=typeof e)return!0;var r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);return 0===n&&13===o}function s(t){function e(){h||d||(h=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <Provider> child into a function."))}function r(){!h&&d&&(h=!0,console.error("With React 0.13, you need to wrap <Provider> child into a function. This restriction will be removed with React 0.14."))}function n(){y||(y=!0,console.error("<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/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions."))}var s=t.Component,c=t.PropTypes,f=t.Children,l=p.default(c),d=i(t),h=!1,y=!1;return function(t){function i(e,r){o(this,i),t.call(this,e,r),this.store=e.store}return u(i,t),i.prototype.getChildContext=function(){return{store:this.store}},a(i,null,[{key:"childContextTypes",value:{store:l.isRequired},enumerable:!0},{key:"propTypes",value:{store:l.isRequired,children:(d?c.func:c.element).isRequired},enumerable:!0}]),i.prototype.componentWillReceiveProps=function(t){var e=this.store,r=t.store;e!==r&&n()},i.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):r(),f.only(t)},i}(s)}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();e.default=s;var c=r(1),p=n(c);t.exports=e.default},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty,u=0;u<r.length;u++)if(!o.call(e,r[u])||t[r[u]]!==e[r[u]])return!1;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(e){return o.bindActionCreators(t,e)}}e.__esModule=!0,e.default=n;var o=r(10);t.exports=e.default},function(t,e,r){"use strict";var n=function(t,e,r,n,o,u,i,s){if(!t){var a;if(void 0===e)a=new 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,u,i,s],p=0;a=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[p++]}))}throw a.framesToPop=1,a}};t.exports=n},function(e,r){e.exports=t},function(t,r){t.exports=e}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(9),u=n(o),s=r(2),i=n(s),a=i.default(u.default),c=a.Provider,p=a.connect;e.Provider=c,e.connect=p},function(t,e){"use strict";function r(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=s.default(t),r=a.default(t);return{Provider:e,connect:r}}e.__esModule=!0,e.default=o;var u=r(4),s=n(u),i=r(3),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){return t.displayName||t.name||"Component"}function i(t){var e=t.Component,r=t.PropTypes,n=f.default(r);return function(r,i,p){function f(t,e){var r=t.getState(),n=R?w(r,e):w(r);return g.default(y.default(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function l(t,e){var r=t.dispatch,n=C?j(r,e):j(r);return g.default(y.default(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function h(t,e,r){var n=O(t,e,r);return g.default(y.default(n),"`mergeProps` must return an object. Instead received %s.",n),n}var b=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],m=Boolean(r),w=r||x,j=y.default(i)?v.default(i):i||P,O=p||_,R=w.length>1,C=j.length>1,M=b.pure,T=void 0===M?!0:M,k=S++;return function(r){var i=function(e){function i(t,r){o(this,i),e.call(this,t,r),this.version=k,this.store=t.store||r.store,g.default(this.store,'Could not find "store" in either the context or '+('props of "'+this.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+this.constructor.displayName+'".')),this.stateProps=f(this.store,t),this.dispatchProps=l(this.store,t),this.state={storeState:null},this.updateState()}return u(i,e),i.prototype.shouldComponentUpdate=function(t,e){if(!T)return this.updateStateProps(t),this.updateDispatchProps(t),this.updateState(t),!0;var r=e.storeState!==this.state.storeState,n=!d.default(t,this.props),o=!1,u=!1;return(r||n&&R)&&(o=this.updateStateProps(t)),n&&C&&(u=this.updateDispatchProps(t)),n||o||u?(this.updateState(t),!0):!1},a(i,null,[{key:"displayName",value:"Connect("+s(r)+")",enumerable:!0},{key:"WrappedComponent",value:r,enumerable:!0},{key:"contextTypes",value:{store:n},enumerable:!0},{key:"propTypes",value:{store:n},enumerable:!0}]),i.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return h(this.stateProps,this.dispatchProps,t)},i.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=f(this.store,t);return d.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},i.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=l(this.store,t);return d.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},i.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];this.nextState=this.computeNextState(t)},i.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},i.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},i.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},i.prototype.componentDidMount=function(){this.trySubscribe()},i.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},i.prototype.handleChange=function(){this.unsubscribe&&this.setState({storeState:this.store.getState()})},i.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},i.prototype.render=function(){return t.createElement(r,c({ref:"wrappedInstance"},this.nextState))},i}(e);return i}}}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=i;var p=r(1),f=n(p),l=r(6),d=n(l),h=r(5),y=n(h),b=r(7),v=n(b),m=r(8),g=n(m),x=function(){return{}},P=function(t){return{dispatch:t}},_=function(t,e,r){return c({},r,t,e)},S=0;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){var e=t.version;if("string"!=typeof e)return!0;var r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);return 0===n&&13===o}function i(t){function e(){h||d||(h=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <Provider> child into a function."))}function r(){!h&&d&&(h=!0,console.error("With React 0.13, you need to wrap <Provider> child into a function. This restriction will be removed with React 0.14."))}function n(){y||(y=!0,console.error("<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/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions."))}var i=t.Component,c=t.PropTypes,f=t.Children,l=p.default(c),d=s(t),h=!1,y=!1;return function(t){function s(e,r){o(this,s),t.call(this,e,r),this.store=e.store}return u(s,t),s.prototype.getChildContext=function(){return{store:this.store}},a(s,null,[{key:"childContextTypes",value:{store:l.isRequired},enumerable:!0},{key:"propTypes",value:{store:l.isRequired,children:(d?c.func:c.element).isRequired},enumerable:!0}]),s.prototype.componentWillReceiveProps=function(t){var e=this.store,r=t.store;e!==r&&n()},s.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):r(),f.only(t)},s}(i)}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();e.default=i;var c=r(1),p=n(c);t.exports=e.default},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty,u=0;u<r.length;u++)if(!o.call(e,r[u])||t[r[u]]!==e[r[u]])return!1;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(e){return o.bindActionCreators(t,e)}}e.__esModule=!0,e.default=n;var o=r(10);t.exports=e.default},function(t,e,r){"use strict";var n=function(t,e,r,n,o,u,s,i){if(!t){var a;if(void 0===e)a=new 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,u,s,i],p=0;a=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[p++]}))}throw a.framesToPop=1,a}};t.exports=n},function(e,r){e.exports=t},function(t,r){t.exports=e}])});

@@ -104,2 +104,4 @@ 'use strict';

if (!pure) {
this.updateStateProps(nextProps);
this.updateDispatchProps(nextProps);
this.updateState(nextProps);

@@ -106,0 +108,0 @@ return true;

{
"name": "react-redux",
"version": "3.0.0",
"version": "3.0.1",
"description": "Official React bindings for Redux",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -1151,2 +1151,61 @@ import expect from 'expect';

it('calls mapState and mapDispatch for impure components', () => {
const store = createStore(() => ({
foo: 'foo',
bar: 'bar'
}));
const mapStateSpy = expect.createSpy();
const mapDispatchSpy = expect.createSpy().andReturn({});
class ImpureComponent extends Component {
render() {
return <Passthrough statefulValue={this.props.value} />;
}
}
const decorator = connect(
(state, {storeGetter}) => {
mapStateSpy();
return {value: state[storeGetter.storeKey]};
},
mapDispatchSpy,
null,
{ pure: false }
);
const Decorated = decorator(ImpureComponent);
class StatefulWrapper extends Component {
state = {
storeGetter: {storeKey: 'foo'}
};
render() {
return <Decorated storeGetter={this.state.storeGetter} />;
};
}
const tree = TestUtils.renderIntoDocument(
<ProviderMock store={store}>
<StatefulWrapper />
</ProviderMock>
);
const target = TestUtils.findRenderedComponentWithType(tree, Passthrough);
const wrapper = TestUtils.findRenderedComponentWithType(tree, StatefulWrapper);
expect(mapStateSpy.calls.length).toBe(2);
expect(mapDispatchSpy.calls.length).toBe(2);
expect(target.props.statefulValue).toEqual('foo');
// Impure update
const storeGetter = wrapper.state.storeGetter;
storeGetter.storeKey = 'bar';
wrapper.setState({ storeGetter });
expect(mapStateSpy.calls.length).toBe(3);
expect(mapDispatchSpy.calls.length).toBe(3);
expect(target.props.statefulValue).toEqual('bar');
});
it('should pass state consistently to mapState', () => {

@@ -1153,0 +1212,0 @@ const store = createStore(stringBuilder);

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc