react-redux
Advanced tools
Comparing version 7.1.0-alpha.0 to 7.1.0-alpha.1
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","redux","react-dom"],t):t((e=e||self).ReactRedux={},e.React,e.Redux,e.ReactDOM)}(this,function(e,t,r,n){"use strict";var o="default"in t?t.default:t;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function s(){}function a(){}a.resetWarningCache=s;var c=i(function(e){e.exports=function(){function e(e,t,r,n,o,i){if(i!==u){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,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:s};return r.PropTypes=r,r}()}),p=o.createContext(null);var f=function(e){e()},d=function(){return f},l=null,y={notify:function(){}};var h=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=y,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){var e,t,r;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=d(),t=[],r=[],{clear:function(){r=l,t=l},notify:function(){var n=t=r;e(function(){for(var e=0;n.length>e;e++)n[e]()})},get:function(){return r},subscribe:function(e){var n=!0;return r===t&&(r=t.slice()),r.push(e),function(){n&&t!==l&&(n=!1,r===t&&(r=t.slice()),r.splice(r.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=y)},e}(),b=function(e){var t,r;function n(t){var r;r=e.call(this,t)||this;var n=t.store;r.notifySubscribers=r.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));var o=new h(n);return o.onStateChange=r.notifySubscribers,r.state={store:n,subscription:o},r.previousState=n.getState(),r}(t=n).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new h(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){return o.createElement((this.props.context||p).Provider,{value:this.state},this.props.children)},n}(t.Component);function m(){return(m=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}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}b.propTypes={store:c.shape({subscribe:c.func.isRequired,dispatch:c.func.isRequired,getState:c.func.isRequired}),context:c.object,children:c.any};var P,S=i(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,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,a=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,l=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case p:case f:case i:case s:case u:case l:return e;default:switch(e=e&&e.$$typeof){case c:case d:case a:return e;default:return t}}case h:case y:case o:return t}}}function m(e){return b(e)===f}t.typeOf=b,t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=a,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=s,t.StrictMode=u,t.Suspense=l,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===u||e===l||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===d)},t.isAsyncMode=function(e){return m(e)||b(e)===p},t.isConcurrentMode=m,t.isContextConsumer=function(e){return b(e)===c},t.isContextProvider=function(e){return b(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return b(e)===d},t.isFragment=function(e){return b(e)===i},t.isLazy=function(e){return b(e)===h},t.isMemo=function(e){return b(e)===y},t.isPortal=function(e){return b(e)===o},t.isProfiler=function(e){return b(e)===s},t.isStrictMode=function(e){return b(e)===u},t.isSuspense=function(e){return b(e)===l}});(P=S)&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default");var g=i(function(e){e.exports=S}),O=g.isContextConsumer,w={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},C={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},x={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},R={};function M(e){return g.isMemo(e)?x:R[e.$$typeof]||w}R[g.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var E=Object.defineProperty,T=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,_=Object.getOwnPropertyDescriptor,N=Object.getPrototypeOf,q=Object.prototype;var D=function e(t,r,n){if("string"!=typeof r){if(q){var o=N(r);o&&o!==q&&e(t,o,n)}var i=T(r);j&&(i=i.concat(j(r)));for(var u=M(t),s=M(r),a=0;i.length>a;++a){var c=i[a];if(!(C[c]||n&&n[c]||s&&s[c]||u&&u[c])){var p=_(r,c);try{E(t,c,p)}catch(e){}}}return t}return t},$=function(e,t,r,n,o,i,u,s){if(!e){var a;if(void 0===t)a=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,u,s],p=0;(a=Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},A=[],F=[null,null];function U(e,t){return[t.payload,e[1]+1]}var W=function(){return[null,0]},k="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function H(e,r){void 0===r&&(r={});var n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,u=r.methodName,s=void 0===u?"connectAdvanced":u,a=r.renderCountProp,c=void 0===a?void 0:a,f=r.shouldHandleStateChanges,d=void 0===f||f,l=r.storeKey,y=void 0===l?"store":l,b=r.withRef,P=void 0!==b&&b,S=r.forwardRef,g=void 0!==S&&S,w=r.context,C=void 0===w?p:w,x=v(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);$(void 0===c,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),$(!P,"withRef is removed. To access the wrapped instance, use a ref on the connected component");$("store"===y,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. You may also pass a {context : MyContext} option to connect");var R=C;return function(r){var n=r.displayName||r.name||"Component",u=i(n),a=m({},x,{getDisplayName:i,methodName:s,renderCountProp:c,shouldHandleStateChanges:d,storeKey:y,displayName:u,wrappedComponentName:n,WrappedComponent:r}),p=x.pure;var f=p?t.useMemo:function(e){return e()};function l(n){var i=t.useMemo(function(){return[n.context,n.forwardedRef,v(n,["context","forwardedRef"])]},[n]),s=i[0],c=i[1],p=i[2],l=t.useMemo(function(){return s&&s.Consumer&&O(o.createElement(s.Consumer,null))?s:R},[s,R]),y=t.useContext(l),b=!!n.store;$(b||!!y&&!!y.store,'Could not find "store" in the context of "'+u+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+u+" in connect options.");var P=n.store||y.store,S=t.useMemo(function(){return function(t){return e(t.dispatch,a)}(P)},[P]),g=t.useMemo(function(){if(!d)return F;var e=new h(P,b?null:y.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[P,b,y]),w=g[0],C=g[1],x=t.useMemo(function(){return b?y:m({},y,{subscription:w})},[b,y,w]),M=t.useReducer(U,A,W),E=M[0][0],T=M[1];if(E&&E.error)throw E.error;var j=t.useRef(),_=t.useRef(p),N=t.useRef(),q=f(function(){return N.current&&p===_.current?N.current:S(P.getState(),p)},[P,E,p]);k(function(){_.current=p,j.current=q,N.current&&(N.current=null,C())}),k(function(){if(d){var e=!1,t=null,r=function(){if(!e){var r,n,o=P.getState();try{r=S(o,_.current)}catch(e){n=e,t=e}n||(t=null),r===j.current?C():(j.current=r,N.current=r,T({type:"STORE_UPDATED",payload:{latestStoreState:o,error:n}}))}};w.onStateChange=r,w.trySubscribe(),r();return function(){if(e=!0,w.tryUnsubscribe(),t)throw t}}},[P,w,S]);var D=t.useMemo(function(){return o.createElement(r,m({},q,{ref:c}))},[c,r,q]);return t.useMemo(function(){return d?o.createElement(l.Provider,{value:x},D):D},[l,D,x])}var b=p?o.memo(l):l;if(b.WrappedComponent=r,b.displayName=u,g){var P=o.forwardRef(function(e,t){return o.createElement(b,m({},e,{forwardedRef:t}))});return P.displayName=u,P.WrappedComponent=r,D(P,r)}return D(b,r)}}var I=Object.prototype.hasOwnProperty;function L(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function K(e,t){if(L(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(!I.call(t,r[n])||!L(e[r[n]],t[r[n]]))return!1;return!0}function Y(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function z(e){return null!=e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function V(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=z(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=z(o),o=n(t,r)),o},n}}function B(e,t,r){return m({},r,e,t)}var G=[function(e){return"function"==typeof e?function(e){return function(t,r){var n,o=r.pure,i=r.areMergedPropsEqual,u=!1;return function(t,r,s){var a=e(t,r,s);return u?o&&i(a,n)||(n=a):(u=!0,n=a),n}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function J(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Q(e,t,r,n,o){var i,u,s,a,c,p=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1;function y(o,l){var y,h,b=!f(l,u),m=!p(o,i);return i=o,u=l,b&&m?(s=e(i,u),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):b?(e.dependsOnOwnProps&&(s=e(i,u)),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):m?(y=e(i,u),h=!d(y,s),s=y,h&&(c=r(s,a,u)),c):c}return function(o,p){return l?y(o,p):(s=e(i=o,u=p),a=t(n,u),c=r(s,a,u),l=!0,c)}}function X(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=v(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),u=r(e,i),s=n(e,i),a=o(e,i);return(i.pure?Q:J)(u,s,a,e,i)}function Z(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 ee(e,t){return e===t}var te,re,ne,oe,ie,ue,se,ae,ce,pe,fe,de,le=(oe=void 0===(ne=(re=void 0===te?{}:te).connectHOC)?H:ne,ue=void 0===(ie=re.mapStateToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(){return{}})}]:ie,ae=void 0===(se=re.mapDispatchToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?Y(function(t){return r.bindActionCreators(e,t)}):void 0}]:se,pe=void 0===(ce=re.mergePropsFactories)?G:ce,de=void 0===(fe=re.selectorFactory)?X:fe,function(e,t,r,n){void 0===n&&(n={});var o=n.pure,i=void 0===o||o,u=n.areStatesEqual,s=void 0===u?ee:u,a=n.areOwnPropsEqual,c=void 0===a?K:a,p=n.areStatePropsEqual,f=void 0===p?K:p,d=n.areMergedPropsEqual,l=void 0===d?K:d,y=v(n,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),h=Z(e,ue,"mapStateToProps"),b=Z(t,ae,"mapDispatchToProps"),P=Z(r,pe,"mergeProps");return oe(de,m({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:h,initMapDispatchToProps:b,initMergeProps:P,pure:i,areStatesEqual:s,areOwnPropsEqual:c,areStatePropsEqual:f,areMergedPropsEqual:l},y))});function ye(){var e=t.useContext(p);return $(e,"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"),e}function he(){return ye().store}function be(){return he().dispatch}function me(e,n){$(e,"You must pass actions to useActions");var o=be();return t.useMemo(function(){return Array.isArray(e)?e.map(function(e){return r.bindActionCreators(e,o)}):r.bindActionCreators(e,o)},n)}var ve="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function Pe(e){$(e,"You must pass a selector to useSelectors");var r=ye(),n=r.store,o=r.subscription,i=t.useReducer(function(e){return e+1},0)[1],u=t.useMemo(function(){return new h(n,o)},[n,o]),s=t.useRef(),a=t.useRef(e),c=void 0;try{c=a.current(n.getState())}catch(e){var p="An error occured while selecting the store state: "+e.message+".";throw s.current&&(p+="\nThe error may be correlated with this previous error:\n"+s.current.stack+"\n\nOriginal stack trace:"),Error(p)}var f=t.useRef(c);return ve(function(){a.current=e,f.current=c,s.current=void 0}),ve(function(){function e(){try{var e=a.current(n.getState());if(K(e,f.current))return;f.current=e}catch(e){s.current=e}i({})}return u.onStateChange=e,u.trySubscribe(),e(),function(){return u.tryUnsubscribe()}},[n,u]),c}f=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=b,e.ReactReduxContext=p,e.connect=le,e.connectAdvanced=H,e.useActions=me,e.useDispatch=be,e.useRedux=function(e,t){return[Pe(e),me(t)]},e.useSelector=Pe,e.useStore=he,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","redux","react-dom"],t):t((e=e||self).ReactRedux={},e.React,e.Redux,e.ReactDOM)}(this,function(e,t,r,n){"use strict";var o="default"in t?t.default:t;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function s(){}function a(){}a.resetWarningCache=s;var c=i(function(e){e.exports=function(){function e(e,t,r,n,o,i){if(i!==u){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,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:s};return r.PropTypes=r,r}()}),p=o.createContext(null);var f=function(e){e()},d=function(){return f},l=null,y={notify:function(){}};var h=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=y,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){var e,t,r;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=d(),t=[],r=[],{clear:function(){r=l,t=l},notify:function(){var n=t=r;e(function(){for(var e=0;n.length>e;e++)n[e]()})},get:function(){return r},subscribe:function(e){var n=!0;return r===t&&(r=t.slice()),r.push(e),function(){n&&t!==l&&(n=!1,r===t&&(r=t.slice()),r.splice(r.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=y)},e}(),m=function(e){var t,r;function n(t){var r;r=e.call(this,t)||this;var n=t.store;r.notifySubscribers=r.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));var o=new h(n);return o.onStateChange=r.notifySubscribers,r.state={store:n,subscription:o},r.previousState=n.getState(),r}(t=n).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new h(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){return o.createElement((this.props.context||p).Provider,{value:this.state},this.props.children)},n}(t.Component);function b(){return(b=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}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}m.propTypes={store:c.shape({subscribe:c.func.isRequired,dispatch:c.func.isRequired,getState:c.func.isRequired}),context:c.object,children:c.any};var P,S=i(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,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,a=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,l=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function m(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case p:case f:case i:case s:case u:case l:return e;default:switch(e=e&&e.$$typeof){case c:case d:case a:return e;default:return t}}case h:case y:case o:return t}}}function b(e){return m(e)===f}t.typeOf=m,t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=a,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=s,t.StrictMode=u,t.Suspense=l,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===u||e===l||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===d)},t.isAsyncMode=function(e){return b(e)||m(e)===p},t.isConcurrentMode=b,t.isContextConsumer=function(e){return m(e)===c},t.isContextProvider=function(e){return m(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return m(e)===d},t.isFragment=function(e){return m(e)===i},t.isLazy=function(e){return m(e)===h},t.isMemo=function(e){return m(e)===y},t.isPortal=function(e){return m(e)===o},t.isProfiler=function(e){return m(e)===s},t.isStrictMode=function(e){return m(e)===u},t.isSuspense=function(e){return m(e)===l}});(P=S)&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default");var g=i(function(e){e.exports=S}),O=g.isContextConsumer,w={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},C={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},x={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},R={};function M(e){return g.isMemo(e)?x:R[e.$$typeof]||w}R[g.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var E=Object.defineProperty,T=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,_=Object.getOwnPropertyDescriptor,N=Object.getPrototypeOf,q=Object.prototype;var D=function e(t,r,n){if("string"!=typeof r){if(q){var o=N(r);o&&o!==q&&e(t,o,n)}var i=T(r);j&&(i=i.concat(j(r)));for(var u=M(t),s=M(r),a=0;i.length>a;++a){var c=i[a];if(!(C[c]||n&&n[c]||s&&s[c]||u&&u[c])){var p=_(r,c);try{E(t,c,p)}catch(e){}}}return t}return t},$=function(e,t,r,n,o,i,u,s){if(!e){var a;if(void 0===t)a=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,u,s],p=0;(a=Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},A=[],F=[null,null];function U(e,t){return[t.payload,e[1]+1]}var W=function(){return[null,0]},k="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function H(e,r){void 0===r&&(r={});var n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,u=r.methodName,s=void 0===u?"connectAdvanced":u,a=r.renderCountProp,c=void 0===a?void 0:a,f=r.shouldHandleStateChanges,d=void 0===f||f,l=r.storeKey,y=void 0===l?"store":l,m=r.withRef,P=void 0!==m&&m,S=r.forwardRef,g=void 0!==S&&S,w=r.context,C=void 0===w?p:w,x=v(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);$(void 0===c,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),$(!P,"withRef is removed. To access the wrapped instance, use a ref on the connected component");$("store"===y,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. You may also pass a {context : MyContext} option to connect");var R=C;return function(r){var n=r.displayName||r.name||"Component",u=i(n),a=b({},x,{getDisplayName:i,methodName:s,renderCountProp:c,shouldHandleStateChanges:d,storeKey:y,displayName:u,wrappedComponentName:n,WrappedComponent:r}),p=x.pure;var f=p?t.useMemo:function(e){return e()};function l(n){var i=t.useMemo(function(){return[n.context,n.forwardedRef,v(n,["context","forwardedRef"])]},[n]),s=i[0],c=i[1],p=i[2],l=t.useMemo(function(){return s&&s.Consumer&&O(o.createElement(s.Consumer,null))?s:R},[s,R]),y=t.useContext(l),m=!!n.store;$(m||!!y&&!!y.store,'Could not find "store" in the context of "'+u+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+u+" in connect options.");var P=n.store||y.store,S=t.useMemo(function(){return function(t){return e(t.dispatch,a)}(P)},[P]),g=t.useMemo(function(){if(!d)return F;var e=new h(P,m?null:y.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[P,m,y]),w=g[0],C=g[1],x=t.useMemo(function(){return m?y:b({},y,{subscription:w})},[m,y,w]),M=t.useReducer(U,A,W),E=M[0][0],T=M[1];if(E&&E.error)throw E.error;var j=t.useRef(),_=t.useRef(p),N=t.useRef(),q=f(function(){return N.current&&p===_.current?N.current:S(P.getState(),p)},[P,E,p]);k(function(){_.current=p,j.current=q,N.current&&(N.current=null,C())}),k(function(){if(d){var e=!1,t=null,r=function(){if(!e){var r,n,o=P.getState();try{r=S(o,_.current)}catch(e){n=e,t=e}n||(t=null),r===j.current?C():(j.current=r,N.current=r,T({type:"STORE_UPDATED",payload:{latestStoreState:o,error:n}}))}};w.onStateChange=r,w.trySubscribe(),r();return function(){if(e=!0,w.tryUnsubscribe(),t)throw t}}},[P,w,S]);var D=t.useMemo(function(){return o.createElement(r,b({},q,{ref:c}))},[c,r,q]);return t.useMemo(function(){return d?o.createElement(l.Provider,{value:x},D):D},[l,D,x])}var m=p?o.memo(l):l;if(m.WrappedComponent=r,m.displayName=u,g){var P=o.forwardRef(function(e,t){return o.createElement(m,b({},e,{forwardedRef:t}))});return P.displayName=u,P.WrappedComponent=r,D(P,r)}return D(m,r)}}var I=Object.prototype.hasOwnProperty;function L(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function K(e,t){if(L(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(!I.call(t,r[n])||!L(e[r[n]],t[r[n]]))return!1;return!0}function Y(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function z(e){return null!=e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function V(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=z(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=z(o),o=n(t,r)),o},n}}function B(e,t,r){return b({},r,e,t)}var G=[function(e){return"function"==typeof e?function(e){return function(t,r){var n,o=r.pure,i=r.areMergedPropsEqual,u=!1;return function(t,r,s){var a=e(t,r,s);return u?o&&i(a,n)||(n=a):(u=!0,n=a),n}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function J(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Q(e,t,r,n,o){var i,u,s,a,c,p=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1;function y(o,l){var y,h,m=!f(l,u),b=!p(o,i);return i=o,u=l,m&&b?(s=e(i,u),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):m?(e.dependsOnOwnProps&&(s=e(i,u)),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):b?(y=e(i,u),h=!d(y,s),s=y,h&&(c=r(s,a,u)),c):c}return function(o,p){return l?y(o,p):(s=e(i=o,u=p),a=t(n,u),c=r(s,a,u),l=!0,c)}}function X(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=v(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),u=r(e,i),s=n(e,i),a=o(e,i);return(i.pure?Q:J)(u,s,a,e,i)}function Z(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 ee(e,t){return e===t}var te,re,ne,oe,ie,ue,se,ae,ce,pe,fe,de,le=(oe=void 0===(ne=(re=void 0===te?{}:te).connectHOC)?H:ne,ue=void 0===(ie=re.mapStateToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(){return{}})}]:ie,ae=void 0===(se=re.mapDispatchToPropsFactories)?[function(e){return"function"==typeof e?V(e):void 0},function(e){return e?void 0:Y(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?Y(function(t){return r.bindActionCreators(e,t)}):void 0}]:se,pe=void 0===(ce=re.mergePropsFactories)?G:ce,de=void 0===(fe=re.selectorFactory)?X:fe,function(e,t,r,n){void 0===n&&(n={});var o=n.pure,i=void 0===o||o,u=n.areStatesEqual,s=void 0===u?ee:u,a=n.areOwnPropsEqual,c=void 0===a?K:a,p=n.areStatePropsEqual,f=void 0===p?K:p,d=n.areMergedPropsEqual,l=void 0===d?K:d,y=v(n,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),h=Z(e,ue,"mapStateToProps"),m=Z(t,ae,"mapDispatchToProps"),P=Z(r,pe,"mergeProps");return oe(de,b({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:h,initMapDispatchToProps:m,initMergeProps:P,pure:i,areStatesEqual:s,areOwnPropsEqual:c,areStatePropsEqual:f,areMergedPropsEqual:l},y))});function ye(){var e=t.useContext(p);return $(e,"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"),e}function he(){return ye().store}function me(){return he().dispatch}function be(e,n){$(e,"You must pass actions to useActions");var o=me();return t.useMemo(function(){return Array.isArray(e)?e.map(function(e){return r.bindActionCreators(e,o)}):r.bindActionCreators(e,o)},n)}var ve="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function Pe(e,r){$(e,"You must pass a selector to useSelectors");var n=ye(),o=n.store,i=n.subscription,u=t.useReducer(function(e){return e+1},0)[1],s=t.useMemo(function(){return new h(o,i)},[o,i]),a=t.useMemo(function(){return e},r),c=t.useRef(),p=t.useRef(a),f=void 0;try{f=a(o.getState())}catch(e){var d="An error occured while selecting the store state: "+e.message+".";throw c.current&&(d+="\nThe error may be correlated with this previous error:\n"+c.current.stack+"\n\nOriginal stack trace:"),Error(d)}var l=t.useRef(f);return ve(function(){p.current=a,l.current=f,c.current=void 0}),ve(function(){function e(){try{var e=p.current(o.getState());if(K(e,l.current))return;l.current=e}catch(e){c.current=e}u({})}return s.onStateChange=e,s.trySubscribe(),e(),function(){return s.tryUnsubscribe()}},[o,s]),f}f=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=m,e.ReactReduxContext=p,e.connect=le,e.connectAdvanced=H,e.useActions=be,e.useDispatch=me,e.useRedux=function(e,t){return[Pe(e),be(t)]},e.useSelector=Pe,e.useStore=he,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -18,4 +18,10 @@ import { useReducer, useRef, useEffect, useMemo, useLayoutEffect } from 'react'; | ||
* as an argument. The selector is called with the store state. | ||
* | ||
* This hook takes a dependencies array as an optional second argument, | ||
* which when passed ensures referential stability of the selector (this is primarily | ||
* useful if you provide a selector that memoizes values). | ||
* | ||
* @param {Function} selector the selector function | ||
* @param {any[]} deps (optional) dependencies array to control referential stability | ||
* of the selector | ||
* | ||
@@ -37,3 +43,3 @@ * @returns {any} the selected state | ||
export function useSelector(selector) { | ||
export function useSelector(selector, deps) { | ||
invariant(selector, "You must pass a selector to useSelectors"); | ||
@@ -53,8 +59,11 @@ | ||
}, [store, contextSub]); | ||
var memoizedSelector = useMemo(function () { | ||
return selector; | ||
}, deps); | ||
var latestSubscriptionCallbackError = useRef(); | ||
var latestSelector = useRef(selector); | ||
var latestSelector = useRef(memoizedSelector); | ||
var selectedState = undefined; | ||
try { | ||
selectedState = latestSelector.current(store.getState()); | ||
selectedState = memoizedSelector(store.getState()); | ||
} catch (err) { | ||
@@ -72,3 +81,3 @@ var errorMessage = "An error occured while selecting the store state: " + err.message + "."; | ||
useIsomorphicLayoutEffect(function () { | ||
latestSelector.current = selector; | ||
latestSelector.current = memoizedSelector; | ||
latestSelectedState.current = selectedState; | ||
@@ -75,0 +84,0 @@ latestSubscriptionCallbackError.current = undefined; |
@@ -30,4 +30,10 @@ "use strict"; | ||
* as an argument. The selector is called with the store state. | ||
* | ||
* This hook takes a dependencies array as an optional second argument, | ||
* which when passed ensures referential stability of the selector (this is primarily | ||
* useful if you provide a selector that memoizes values). | ||
* | ||
* @param {Function} selector the selector function | ||
* @param {any[]} deps (optional) dependencies array to control referential stability | ||
* of the selector | ||
* | ||
@@ -49,3 +55,3 @@ * @returns {any} the selected state | ||
function useSelector(selector) { | ||
function useSelector(selector, deps) { | ||
(0, _invariant["default"])(selector, "You must pass a selector to useSelectors"); | ||
@@ -65,8 +71,11 @@ | ||
}, [store, contextSub]); | ||
var memoizedSelector = (0, _react.useMemo)(function () { | ||
return selector; | ||
}, deps); | ||
var latestSubscriptionCallbackError = (0, _react.useRef)(); | ||
var latestSelector = (0, _react.useRef)(selector); | ||
var latestSelector = (0, _react.useRef)(memoizedSelector); | ||
var selectedState = undefined; | ||
try { | ||
selectedState = latestSelector.current(store.getState()); | ||
selectedState = memoizedSelector(store.getState()); | ||
} catch (err) { | ||
@@ -84,3 +93,3 @@ var errorMessage = "An error occured while selecting the store state: " + err.message + "."; | ||
useIsomorphicLayoutEffect(function () { | ||
latestSelector.current = selector; | ||
latestSelector.current = memoizedSelector; | ||
latestSelectedState.current = selectedState; | ||
@@ -87,0 +96,0 @@ latestSubscriptionCallbackError.current = undefined; |
{ | ||
"name": "react-redux", | ||
"version": "7.1.0-alpha.0", | ||
"version": "7.1.0-alpha.1", | ||
"description": "Official React bindings for Redux", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -21,4 +21,10 @@ import { useReducer, useRef, useEffect, useMemo, useLayoutEffect } from 'react' | ||
* as an argument. The selector is called with the store state. | ||
* | ||
* This hook takes a dependencies array as an optional second argument, | ||
* which when passed ensures referential stability of the selector (this is primarily | ||
* useful if you provide a selector that memoizes values). | ||
* | ||
* @param {Function} selector the selector function | ||
* @param {any[]} deps (optional) dependencies array to control referential stability | ||
* of the selector | ||
* | ||
@@ -39,3 +45,3 @@ * @returns {any} the selected state | ||
*/ | ||
export function useSelector(selector) { | ||
export function useSelector(selector, deps) { | ||
invariant(selector, `You must pass a selector to useSelectors`) | ||
@@ -51,4 +57,6 @@ | ||
const memoizedSelector = useMemo(() => selector, deps) | ||
const latestSubscriptionCallbackError = useRef() | ||
const latestSelector = useRef(selector) | ||
const latestSelector = useRef(memoizedSelector) | ||
@@ -58,3 +66,3 @@ let selectedState = undefined | ||
try { | ||
selectedState = latestSelector.current(store.getState()) | ||
selectedState = memoizedSelector(store.getState()) | ||
} catch (err) { | ||
@@ -77,3 +85,3 @@ let errorMessage = `An error occured while selecting the store state: ${ | ||
useIsomorphicLayoutEffect(() => { | ||
latestSelector.current = selector | ||
latestSelector.current = memoizedSelector | ||
latestSelectedState.current = selectedState | ||
@@ -80,0 +88,0 @@ latestSubscriptionCallbackError.current = undefined |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280888
5824