react-redux
Advanced tools
Comparing version 8.0.0-beta.2 to 8.0.0-beta.3
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRedux={},e.React,e.ReactDOM)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);function u(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},r.exports),r.exports}var c="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.default.useSyncExternalStore,a=o.default.useRef,i=o.default.useEffect,f=o.default.useMemo,l=o.default.useDebugValue,p={useSyncExternalStoreWithSelector:function(e,t,r,n,o){var u=a(null);if(null===u.current){var p={hasValue:!1,value:null};u.current=p}else p=u.current;u=f((function(){function e(e){if(!a){if(a=!0,u=e,e=n(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return s=t}return s=e}if(t=s,c(u,e))return t;var r=n(e);return void 0!==o&&o(t,r)?t:(u=e,s=r)}var u,s,a=!1,i=void 0===r?null:r;return[function(){return e(t())},null===i?void 0:function(){return e(i())}]}),[t,r,n,o]);var d=s(e,u[0],u[1]);return i((function(){p.hasValue=!0,p.value=d}),[d]),l(d),d}},d=u((function(e){e.exports=p}));let y=function(e){e()};const m=()=>y,b=o.default.createContext(null);function S(){return t.useContext(b)}const v=()=>{throw Error("uSES not initialized!")};let g=v;const h=(e,t)=>e===t;function P(e=b){const r=e===b?S:()=>t.useContext(e);return function(e,n=h){const{store:o,getServerState:u}=r(),c=g(o.subscribe,o.getState,u||o.getState,e,n);return t.useDebugValue(c),c}}const $=P();function w(){return(w=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 x(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;u.length>n;n++)0>t.indexOf(r=u[n])&&(o[r]=e[r]);return o} | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRedux={},e.React,e.ReactDOM)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);function u(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},r.exports),r.exports}var c="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.default.useSyncExternalStore,a=o.default.useRef,i=o.default.useEffect,f=o.default.useMemo,l=o.default.useDebugValue,p={useSyncExternalStoreWithSelector:function(e,t,r,n,o){var u=a(null);if(null===u.current){var p={hasValue:!1,value:null};u.current=p}else p=u.current;u=f((function(){function e(e){if(!a){if(a=!0,u=e,e=n(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return s=t}return s=e}if(t=s,c(u,e))return t;var r=n(e);return void 0!==o&&o(t,r)?t:(u=e,s=r)}var u,s,a=!1,i=void 0===r?null:r;return[function(){return e(t())},null===i?void 0:function(){return e(i())}]}),[t,r,n,o]);var d=s(e,u[0],u[1]);return i((function(){p.hasValue=!0,p.value=d}),[d]),l(d),d}},d=u((function(e){e.exports=p}));let y=function(e){e()};const m=()=>y,b=o.default.createContext(null);function S(){return t.useContext(b)}const v=()=>{throw Error("uSES not initialized!")};let g=v;const h=(e,t)=>e===t;function P(e=b){const r=e===b?S:()=>t.useContext(e);return function(e,n=h){const{store:o,subscription:u,getServerState:c}=r(),s=g(u.addNestedSub,o.getState,c||o.getState,e,n);return t.useDebugValue(s),s}}const $=P();function w(){return(w=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 x(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;u.length>n;n++)0>t.indexOf(r=u[n])&&(o[r]=e[r]);return o} | ||
/** @license React v16.13.1 | ||
@@ -9,3 +9,3 @@ * react-is.production.min.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var O="function"==typeof Symbol&&Symbol.for,M=O?Symbol.for("react.element"):60103,C=O?Symbol.for("react.portal"):60106,E=O?Symbol.for("react.fragment"):60107,j=O?Symbol.for("react.strict_mode"):60108,R=O?Symbol.for("react.profiler"):60114,T=O?Symbol.for("react.provider"):60109,q=O?Symbol.for("react.context"):60110,N=O?Symbol.for("react.async_mode"):60111,_=O?Symbol.for("react.concurrent_mode"):60111,D=O?Symbol.for("react.forward_ref"):60112,F=O?Symbol.for("react.suspense"):60113,k=O?Symbol.for("react.suspense_list"):60120,L=O?Symbol.for("react.memo"):60115,z=O?Symbol.for("react.lazy"):60116,V=O?Symbol.for("react.block"):60121,W=O?Symbol.for("react.fundamental"):60117,U=O?Symbol.for("react.responder"):60118,H=O?Symbol.for("react.scope"):60119;function A(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case M:switch(e=e.type){case N:case _:case E:case R:case j:case F:return e;default:switch(e=e&&e.$$typeof){case q:case D:case z:case L:case T:return e;default:return t}}case C:return t}}}function I(e){return A(e)===_}var B={AsyncMode:N,ConcurrentMode:_,ContextConsumer:q,ContextProvider:T,Element:M,ForwardRef:D,Fragment:E,Lazy:z,Memo:L,Portal:C,Profiler:R,StrictMode:j,Suspense:F,isAsyncMode:function(e){return I(e)||A(e)===N},isConcurrentMode:I,isContextConsumer:function(e){return A(e)===q},isContextProvider:function(e){return A(e)===T},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===M},isForwardRef:function(e){return A(e)===D},isFragment:function(e){return A(e)===E},isLazy:function(e){return A(e)===z},isMemo:function(e){return A(e)===L},isPortal:function(e){return A(e)===C},isProfiler:function(e){return A(e)===R},isStrictMode:function(e){return A(e)===j},isSuspense:function(e){return A(e)===F},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===E||e===_||e===R||e===j||e===F||e===k||"object"==typeof e&&null!==e&&(e.$$typeof===z||e.$$typeof===L||e.$$typeof===T||e.$$typeof===q||e.$$typeof===D||e.$$typeof===W||e.$$typeof===U||e.$$typeof===H||e.$$typeof===V)},typeOf:A},G=u((function(e){e.exports=B})),J={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},K={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Q={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},X={};function Y(e){return G.isMemo(e)?Q:X[e.$$typeof]||J}X[G.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},X[G.Memo]=Q;var Z=Object.defineProperty,ee=Object.getOwnPropertyNames,te=Object.getOwnPropertySymbols,re=Object.getOwnPropertyDescriptor,ne=Object.getPrototypeOf,oe=Object.prototype;var ue=function e(t,r,n){if("string"!=typeof r){if(oe){var o=ne(r);o&&o!==oe&&e(t,o,n)}var u=ee(r);te&&(u=u.concat(te(r)));for(var c=Y(t),s=Y(r),a=0;u.length>a;++a){var i=u[a];if(!(K[i]||n&&n[i]||s&&s[i]||c&&c[i])){var f=re(r,i);try{Z(t,i,f)}catch(e){}}}}return t},ce=60103,se=60106,ae=60107,ie=60108,fe=60114,le=60109,pe=60110,de=60112,ye=60113,me=60120,be=60115,Se=60116,ve=60129,ge=60130,he=60131; | ||
*/var O="function"==typeof Symbol&&Symbol.for,M=O?Symbol.for("react.element"):60103,C=O?Symbol.for("react.portal"):60106,E=O?Symbol.for("react.fragment"):60107,j=O?Symbol.for("react.strict_mode"):60108,R=O?Symbol.for("react.profiler"):60114,T=O?Symbol.for("react.provider"):60109,N=O?Symbol.for("react.context"):60110,q=O?Symbol.for("react.async_mode"):60111,_=O?Symbol.for("react.concurrent_mode"):60111,D=O?Symbol.for("react.forward_ref"):60112,F=O?Symbol.for("react.suspense"):60113,k=O?Symbol.for("react.suspense_list"):60120,L=O?Symbol.for("react.memo"):60115,z=O?Symbol.for("react.lazy"):60116,V=O?Symbol.for("react.block"):60121,W=O?Symbol.for("react.fundamental"):60117,U=O?Symbol.for("react.responder"):60118,H=O?Symbol.for("react.scope"):60119;function A(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case M:switch(e=e.type){case q:case _:case E:case R:case j:case F:return e;default:switch(e=e&&e.$$typeof){case N:case D:case z:case L:case T:return e;default:return t}}case C:return t}}}function I(e){return A(e)===_}var B={AsyncMode:q,ConcurrentMode:_,ContextConsumer:N,ContextProvider:T,Element:M,ForwardRef:D,Fragment:E,Lazy:z,Memo:L,Portal:C,Profiler:R,StrictMode:j,Suspense:F,isAsyncMode:function(e){return I(e)||A(e)===q},isConcurrentMode:I,isContextConsumer:function(e){return A(e)===N},isContextProvider:function(e){return A(e)===T},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===M},isForwardRef:function(e){return A(e)===D},isFragment:function(e){return A(e)===E},isLazy:function(e){return A(e)===z},isMemo:function(e){return A(e)===L},isPortal:function(e){return A(e)===C},isProfiler:function(e){return A(e)===R},isStrictMode:function(e){return A(e)===j},isSuspense:function(e){return A(e)===F},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===E||e===_||e===R||e===j||e===F||e===k||"object"==typeof e&&null!==e&&(e.$$typeof===z||e.$$typeof===L||e.$$typeof===T||e.$$typeof===N||e.$$typeof===D||e.$$typeof===W||e.$$typeof===U||e.$$typeof===H||e.$$typeof===V)},typeOf:A},G=u((function(e){e.exports=B})),J={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},K={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Q={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},X={};function Y(e){return G.isMemo(e)?Q:X[e.$$typeof]||J}X[G.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},X[G.Memo]=Q;var Z=Object.defineProperty,ee=Object.getOwnPropertyNames,te=Object.getOwnPropertySymbols,re=Object.getOwnPropertyDescriptor,ne=Object.getPrototypeOf,oe=Object.prototype;var ue=function e(t,r,n){if("string"!=typeof r){if(oe){var o=ne(r);o&&o!==oe&&e(t,o,n)}var u=ee(r);te&&(u=u.concat(te(r)));for(var c=Y(t),s=Y(r),a=0;u.length>a;++a){var i=u[a];if(!(K[i]||n&&n[i]||s&&s[i]||c&&c[i])){var f=re(r,i);try{Z(t,i,f)}catch(e){}}}}return t},ce=60103,se=60106,ae=60107,ie=60108,fe=60114,le=60109,pe=60110,de=60112,ye=60113,me=60120,be=60115,Se=60116,ve=60129,ge=60130,he=60131; | ||
/** @license React vundefined | ||
@@ -18,2 +18,2 @@ * react-is.production.min.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/if("function"==typeof Symbol&&Symbol.for){var Pe=Symbol.for;ce=Pe("react.element"),se=Pe("react.portal"),ae=Pe("react.fragment"),ie=Pe("react.strict_mode"),fe=Pe("react.profiler"),le=Pe("react.provider"),pe=Pe("react.context"),de=Pe("react.forward_ref"),ye=Pe("react.suspense"),me=Pe("react.suspense_list"),be=Pe("react.memo"),Se=Pe("react.lazy"),ve=Pe("react.debug_trace_mode"),ge=Pe("react.offscreen"),he=Pe("react.legacy_hidden")}var $e=0;function we(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case ce:switch(e=e.type){case ae:case fe:case ie:case ye:case me:return e;default:switch(e=e&&e.$$typeof){case pe:case de:case Se:case be:case le:return e;default:return t}}case se:return t}}}"function"==typeof Symbol&&($e=Symbol.for("react.module.reference"));var xe={ContextConsumer:pe,ContextProvider:le,Element:ce,ForwardRef:de,Fragment:ae,Lazy:Se,Memo:be,Portal:se,Profiler:fe,StrictMode:ie,Suspense:ye,SuspenseList:me,isAsyncMode:function(){return!1},isConcurrentMode:function(){return!1},isContextConsumer:function(e){return we(e)===pe},isContextProvider:function(e){return we(e)===le},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===ce},isForwardRef:function(e){return we(e)===de},isFragment:function(e){return we(e)===ae},isLazy:function(e){return we(e)===Se},isMemo:function(e){return we(e)===be},isPortal:function(e){return we(e)===se},isProfiler:function(e){return we(e)===fe},isStrictMode:function(e){return we(e)===ie},isSuspense:function(e){return we(e)===ye},isSuspenseList:function(e){return we(e)===me},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===ae||e===fe||e===ve||e===ie||e===ye||e===me||e===he||e===ge||"object"==typeof e&&null!==e&&(e.$$typeof===Se||e.$$typeof===be||e.$$typeof===le||e.$$typeof===pe||e.$$typeof===de||e.$$typeof===$e||void 0!==e.getModuleId)},typeOf:we},Oe=u((function(e){e.exports=xe}));const Me=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function Ce(e,t,r,n,{areStatesEqual:o,areOwnPropsEqual:u,areStatePropsEqual:c}){let s,a,i,f,l,p=!1;function d(p,d){const y=!u(d,a),m=!o(p,s);return s=p,a=d,y&&m?(i=e(s,a),t.dependsOnOwnProps&&(f=t(n,a)),l=r(i,f,a),l):y?(e.dependsOnOwnProps&&(i=e(s,a)),t.dependsOnOwnProps&&(f=t(n,a)),l=r(i,f,a),l):m?function(){const t=e(s,a),n=!c(t,i);return i=t,n&&(l=r(i,f,a)),l}():l}return function(o,u){return p?d(o,u):(s=o,a=u,i=e(s,a),f=t(n,a),l=r(i,f,a),p=!0,l)}}function Ee(e){return function(t){const r=e(t);function n(){return r}return n.dependsOnOwnProps=!1,n}}function je(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function Re(e,t){return function(t,{}){const r=function(e,t){return r.mapToProps(e,r.dependsOnOwnProps?t:void 0)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=je(e);let o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=je(o),o=r(t,n)),o},r}}var Te=[function(e){return"function"==typeof e?Re(e):void 0},function(e){return e?void 0:Ee((e=>({dispatch:e})))},function(e){return e&&"object"==typeof e?Ee((t=>function(e,t){const r={};for(const n in e){const o=e[n];"function"==typeof o&&(r[n]=(...e)=>t(o(...e)))}return r}(e,t))):void 0}];var qe=[function(e){return"function"==typeof e?Re(e):void 0},function(e){return e?void 0:Ee((()=>({})))}];function Ne(e,t,r){return w({},r,e,t)}var _e=[function(e){return"function"==typeof e?function(e){return function(t,{areMergedPropsEqual:r}){let n,o=!1;return function(t,u,c){const s=e(t,u,c);return o?r(s,n)||(n=s):(o=!0,n=s),n}}}(e):void 0},function(e){return e?void 0:()=>Ne}];const De={notify(){},get:()=>[]};function Fe(e,t){let r,n=De;function o(){c.onStateChange&&c.onStateChange()}function u(){r||(r=t?t.addNestedSub(o):e.subscribe(o),n=function(){const e=m();let t=null,r=null;return{clear(){t=null,r=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],r=t;for(;r;)e.push(r),r=r.next;return e},subscribe(e){let n=!0,o=r={callback:e,next:null,prev:r};return o.prev?o.prev.next=o:t=o,function(){n&&null!==t&&(n=!1,o.next?o.next.prev=o.prev:r=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const c={addNestedSub:function(e){return u(),n.subscribe(e)},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:o,isSubscribed:function(){return!!r},trySubscribe:u,tryUnsubscribe:function(){r&&(r(),r=void 0,n.clear(),n=De)},getListeners:()=>n};return c}const ke=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?t.useLayoutEffect:t.useEffect;function Le(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ze(e,t){if(Le(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;r.length>n;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Le(e[r[n]],t[r[n]]))return!1;return!0}const Ve=["reactReduxForwardedRef"];let We=v;const Ue=[null,null];function He(e,t,r,n,o,u){e.current=n,r.current=!1,o.current&&(o.current=null,u())}function Ae(e,t,r){for(let r=t.length-1;r>=0;r--){const n=t[r](e);if(n)return n}return(t,n)=>{throw Error(`Invalid value of type ${typeof e} for ${r} argument when connecting component ${n.wrappedComponentName}.`)}}function Ie(e,t){return e===t}function Be(e=b){const r=e===b?S:()=>t.useContext(e);return function(){const{store:e}=r();return e}}const Ge=Be();function Je(e=b){const t=e===b?Ge:Be(e);return function(){return t().dispatch}}const Ke=Je();g=d.useSyncExternalStoreWithSelector,(e=>{We=e})(t.useSyncExternalStore),y=r.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return r.unstable_batchedUpdates}}),e.Provider=function({store:e,context:r,children:n,serverState:u}){const c=t.useMemo((()=>{const t=Fe(e);return{store:e,subscription:t,getServerState:u?()=>u:void 0}}),[e,u]),s=t.useMemo((()=>e.getState()),[e]);return ke((()=>{const{subscription:t}=c;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[c,s]),o.default.createElement((r||b).Provider,{value:c},n)},e.ReactReduxContext=b,e.connect=function(e,r,n,{pure:u,areStatesEqual:c=Ie,areOwnPropsEqual:s=ze,areStatePropsEqual:a=ze,areMergedPropsEqual:i=ze,forwardRef:f=!1,context:l=b}={}){const p=l,d=Ae(e,qe,"mapStateToProps"),y=Ae(r,Te,"mapDispatchToProps"),m=Ae(n,_e,"mergeProps"),S=!!e;return e=>{const r=e.displayName||e.name||"Component",n=`Connect(${r})`,l={pure:u,shouldHandleStateChanges:S,displayName:n,wrappedComponentName:r,WrappedComponent:e,initMapStateToProps:d,initMapDispatchToProps:y,initMergeProps:m,areStatesEqual:c,areStatePropsEqual:a,areOwnPropsEqual:s,areMergedPropsEqual:i},b=u?t.useMemo:e=>e();function v(r){const[n,u,c]=t.useMemo((()=>{const{reactReduxForwardedRef:e}=r,t=x(r,Ve);return[r.context,e,t]}),[r]),s=t.useMemo((()=>n&&n.Consumer&&Oe.isContextConsumer(o.default.createElement(n.Consumer,null))?n:p),[n,p]),a=t.useContext(s),i=!!r.store&&!!r.store.getState&&!!r.store.dispatch,f=i?r.store:a.store,d=!!a&&!!a.store?a.getServerState:f.getState,y=t.useMemo((()=>function(e,t){let{initMapStateToProps:r,initMapDispatchToProps:n,initMergeProps:o}=t,u=x(t,Me);return Ce(r(e,u),n(e,u),o(e,u),e,u)}(f.dispatch,l)),[f]),[m,v]=t.useMemo((()=>{if(!S)return Ue;const e=Fe(f,i?void 0:a.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[f,i,a]),g=t.useMemo((()=>i?a:w({},a,{subscription:m})),[i,a,m]),h=t.useRef(),P=t.useRef(c),$=t.useRef(),O=t.useRef(!1);t.useRef(!1);const M=t.useRef(!1),C=t.useRef();ke((()=>(M.current=!0,()=>{M.current=!1})),[]);const E=b((()=>()=>$.current&&c===P.current?$.current:y(f.getState(),c)),[f,c]),j=t.useMemo((()=>e=>m?function(e,t,r,n,o,u,c,s,a,i,f){if(!e)return()=>{};let l=!1,p=null;const d=()=>{if(l||!s.current)return;const e=t.getState();let r,d;try{r=n(e,o.current)}catch(e){d=e,p=e}d||(p=null),r===u.current?c.current||i():(u.current=r,a.current=r,c.current=!0,f())};return r.onStateChange=d,r.trySubscribe(),d(),()=>{if(l=!0,r.tryUnsubscribe(),r.onStateChange=null,p)throw p}}(S,f,m,y,P,h,O,M,$,v,e):()=>{}),[m]);var R,T,q;let N;R=He,T=[P,h,O,c,$,v],ke((()=>R(...T)),q);try{N=We(j,E,d?()=>y(d(),c):E)}catch(e){throw C.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${C.current.stack}\n\n`),e}ke((()=>{C.current=void 0,$.current=void 0,h.current=N}));const _=t.useMemo((()=>o.default.createElement(e,w({},N,{ref:u}))),[u,e,N]);return t.useMemo((()=>S?o.default.createElement(s.Provider,{value:g},_):_),[s,_,g])}const g=o.default.memo(v);if(g.WrappedComponent=e,g.displayName=v.displayName=n,f){const t=o.default.forwardRef((function(e,t){return o.default.createElement(g,w({},e,{reactReduxForwardedRef:t}))}));return t.displayName=n,t.WrappedComponent=e,ue(t,e)}return ue(g,e)}},e.createDispatchHook=Je,e.createSelectorHook=P,e.createStoreHook=Be,e.shallowEqual=ze,e.useDispatch=Ke,e.useSelector=$,e.useStore=Ge,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/if("function"==typeof Symbol&&Symbol.for){var Pe=Symbol.for;ce=Pe("react.element"),se=Pe("react.portal"),ae=Pe("react.fragment"),ie=Pe("react.strict_mode"),fe=Pe("react.profiler"),le=Pe("react.provider"),pe=Pe("react.context"),de=Pe("react.forward_ref"),ye=Pe("react.suspense"),me=Pe("react.suspense_list"),be=Pe("react.memo"),Se=Pe("react.lazy"),ve=Pe("react.debug_trace_mode"),ge=Pe("react.offscreen"),he=Pe("react.legacy_hidden")}var $e=0;function we(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case ce:switch(e=e.type){case ae:case fe:case ie:case ye:case me:return e;default:switch(e=e&&e.$$typeof){case pe:case de:case Se:case be:case le:return e;default:return t}}case se:return t}}}"function"==typeof Symbol&&($e=Symbol.for("react.module.reference"));var xe={ContextConsumer:pe,ContextProvider:le,Element:ce,ForwardRef:de,Fragment:ae,Lazy:Se,Memo:be,Portal:se,Profiler:fe,StrictMode:ie,Suspense:ye,SuspenseList:me,isAsyncMode:function(){return!1},isConcurrentMode:function(){return!1},isContextConsumer:function(e){return we(e)===pe},isContextProvider:function(e){return we(e)===le},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===ce},isForwardRef:function(e){return we(e)===de},isFragment:function(e){return we(e)===ae},isLazy:function(e){return we(e)===Se},isMemo:function(e){return we(e)===be},isPortal:function(e){return we(e)===se},isProfiler:function(e){return we(e)===fe},isStrictMode:function(e){return we(e)===ie},isSuspense:function(e){return we(e)===ye},isSuspenseList:function(e){return we(e)===me},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===ae||e===fe||e===ve||e===ie||e===ye||e===me||e===he||e===ge||"object"==typeof e&&null!==e&&(e.$$typeof===Se||e.$$typeof===be||e.$$typeof===le||e.$$typeof===pe||e.$$typeof===de||e.$$typeof===$e||void 0!==e.getModuleId)},typeOf:we},Oe=u((function(e){e.exports=xe}));const Me=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function Ce(e,t,r,n,{areStatesEqual:o,areOwnPropsEqual:u,areStatePropsEqual:c}){let s,a,i,f,l,p=!1;function d(p,d){const y=!u(d,a),m=!o(p,s);return s=p,a=d,y&&m?(i=e(s,a),t.dependsOnOwnProps&&(f=t(n,a)),l=r(i,f,a),l):y?(e.dependsOnOwnProps&&(i=e(s,a)),t.dependsOnOwnProps&&(f=t(n,a)),l=r(i,f,a),l):m?function(){const t=e(s,a),n=!c(t,i);return i=t,n&&(l=r(i,f,a)),l}():l}return function(o,u){return p?d(o,u):(s=o,a=u,i=e(s,a),f=t(n,a),l=r(i,f,a),p=!0,l)}}function Ee(e){return function(t){const r=e(t);function n(){return r}return n.dependsOnOwnProps=!1,n}}function je(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function Re(e,t){return function(t,{}){const r=function(e,t){return r.mapToProps(e,r.dependsOnOwnProps?t:void 0)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=je(e);let o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=je(o),o=r(t,n)),o},r}}var Te=[function(e){return"function"==typeof e?Re(e):void 0},function(e){return e?void 0:Ee((e=>({dispatch:e})))},function(e){return e&&"object"==typeof e?Ee((t=>function(e,t){const r={};for(const n in e){const o=e[n];"function"==typeof o&&(r[n]=(...e)=>t(o(...e)))}return r}(e,t))):void 0}];var Ne=[function(e){return"function"==typeof e?Re(e):void 0},function(e){return e?void 0:Ee((()=>({})))}];function qe(e,t,r){return w({},r,e,t)}var _e=[function(e){return"function"==typeof e?function(e){return function(t,{areMergedPropsEqual:r}){let n,o=!1;return function(t,u,c){const s=e(t,u,c);return o?r(s,n)||(n=s):(o=!0,n=s),n}}}(e):void 0},function(e){return e?void 0:()=>qe}];const De={notify(){},get:()=>[]};function Fe(e,t){let r,n=De;function o(){c.onStateChange&&c.onStateChange()}function u(){r||(r=t?t.addNestedSub(o):e.subscribe(o),n=function(){const e=m();let t=null,r=null;return{clear(){t=null,r=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],r=t;for(;r;)e.push(r),r=r.next;return e},subscribe(e){let n=!0,o=r={callback:e,next:null,prev:r};return o.prev?o.prev.next=o:t=o,function(){n&&null!==t&&(n=!1,o.next?o.next.prev=o.prev:r=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const c={addNestedSub:function(e){return u(),n.subscribe(e)},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:o,isSubscribed:function(){return!!r},trySubscribe:u,tryUnsubscribe:function(){r&&(r(),r=void 0,n.clear(),n=De)},getListeners:()=>n};return c}const ke=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?t.useLayoutEffect:t.useEffect;function Le(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ze(e,t){if(Le(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;r.length>n;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Le(e[r[n]],t[r[n]]))return!1;return!0}const Ve=["reactReduxForwardedRef"];let We=v;const Ue=[null,null];function He(e,t,r,n,o,u){e.current=n,r.current=!1,o.current&&(o.current=null,u())}function Ae(e,t,r){for(let r=t.length-1;r>=0;r--){const n=t[r](e);if(n)return n}return(t,n)=>{throw Error(`Invalid value of type ${typeof e} for ${r} argument when connecting component ${n.wrappedComponentName}.`)}}function Ie(e,t){return e===t}function Be(e=b){const r=e===b?S:()=>t.useContext(e);return function(){const{store:e}=r();return e}}const Ge=Be();function Je(e=b){const t=e===b?Ge:Be(e);return function(){return t().dispatch}}const Ke=Je();g=d.useSyncExternalStoreWithSelector,(e=>{We=e})(t.useSyncExternalStore),y=r.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return r.unstable_batchedUpdates}}),e.Provider=function({store:e,context:r,children:n,serverState:u}){const c=t.useMemo((()=>{const t=Fe(e);return{store:e,subscription:t,getServerState:u?()=>u:void 0}}),[e,u]),s=t.useMemo((()=>e.getState()),[e]);return ke((()=>{const{subscription:t}=c;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[c,s]),o.default.createElement((r||b).Provider,{value:c},n)},e.ReactReduxContext=b,e.connect=function(e,r,n,{areStatesEqual:u=Ie,areOwnPropsEqual:c=ze,areStatePropsEqual:s=ze,areMergedPropsEqual:a=ze,forwardRef:i=!1,context:f=b}={}){const l=f,p=Ae(e,Ne,"mapStateToProps"),d=Ae(r,Te,"mapDispatchToProps"),y=Ae(n,_e,"mergeProps"),m=!!e;return e=>{const r=e.displayName||e.name||"Component",n=`Connect(${r})`,f={shouldHandleStateChanges:m,displayName:n,wrappedComponentName:r,WrappedComponent:e,initMapStateToProps:p,initMapDispatchToProps:d,initMergeProps:y,areStatesEqual:u,areStatePropsEqual:s,areOwnPropsEqual:c,areMergedPropsEqual:a};function b(r){const[n,u,c]=t.useMemo((()=>{const{reactReduxForwardedRef:e}=r,t=x(r,Ve);return[r.context,e,t]}),[r]),s=t.useMemo((()=>n&&n.Consumer&&Oe.isContextConsumer(o.default.createElement(n.Consumer,null))?n:l),[n,l]),a=t.useContext(s),i=!!r.store&&!!r.store.getState&&!!r.store.dispatch,p=i?r.store:a.store,d=!!a&&!!a.store?a.getServerState:p.getState,y=t.useMemo((()=>function(e,t){let{initMapStateToProps:r,initMapDispatchToProps:n,initMergeProps:o}=t,u=x(t,Me);return Ce(r(e,u),n(e,u),o(e,u),e,u)}(p.dispatch,f)),[p]),[b,S]=t.useMemo((()=>{if(!m)return Ue;const e=Fe(p,i?void 0:a.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[p,i,a]),v=t.useMemo((()=>i?a:w({},a,{subscription:b})),[i,a,b]),g=t.useRef(),h=t.useRef(c),P=t.useRef(),$=t.useRef(!1);t.useRef(!1);const O=t.useRef(!1),M=t.useRef();ke((()=>(O.current=!0,()=>{O.current=!1})),[]);const C=t.useMemo((()=>()=>P.current&&c===h.current?P.current:y(p.getState(),c)),[p,c]),E=t.useMemo((()=>e=>b?function(e,t,r,n,o,u,c,s,a,i,f){if(!e)return()=>{};let l=!1,p=null;const d=()=>{if(l||!s.current)return;const e=t.getState();let r,d;try{r=n(e,o.current)}catch(e){d=e,p=e}d||(p=null),r===u.current?c.current||i():(u.current=r,a.current=r,c.current=!0,f())};return r.onStateChange=d,r.trySubscribe(),d(),()=>{if(l=!0,r.tryUnsubscribe(),r.onStateChange=null,p)throw p}}(m,p,b,y,h,g,$,O,P,S,e):()=>{}),[b]);var j,R,T;let N;j=He,R=[h,g,$,c,P,S],ke((()=>j(...R)),T);try{N=We(E,C,d?()=>y(d(),c):C)}catch(e){throw M.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${M.current.stack}\n\n`),e}ke((()=>{M.current=void 0,P.current=void 0,g.current=N}));const q=t.useMemo((()=>o.default.createElement(e,w({},N,{ref:u}))),[u,e,N]);return t.useMemo((()=>m?o.default.createElement(s.Provider,{value:v},q):q),[s,q,v])}const S=o.default.memo(b);if(S.WrappedComponent=e,S.displayName=b.displayName=n,i){const t=o.default.forwardRef((function(e,t){return o.default.createElement(S,w({},e,{reactReduxForwardedRef:t}))}));return t.displayName=n,t.WrappedComponent=e,ue(t,e)}return ue(S,e)}},e.createDispatchHook=Je,e.createSelectorHook=P,e.createStoreHook=Be,e.shallowEqual=ze,e.useDispatch=Ke,e.useSelector=$,e.useStore=Ge,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -212,3 +212,2 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const selectorFactoryOptions = { | ||
pure, | ||
shouldHandleStateChanges, | ||
@@ -226,8 +225,4 @@ displayName, | ||
areMergedPropsEqual | ||
}; // If we aren't running in "pure" mode, we don't want to memoize values. | ||
// To avoid conditionally calling hooks, we fall back to a tiny wrapper | ||
// that just executes the given callback immediately. | ||
}; | ||
const usePureOnlyMemo = pure ? useMemo : callback => callback(); | ||
function ConnectFunction(props) { | ||
@@ -313,3 +308,3 @@ const [propsContext, reactReduxForwardedRef, wrapperProps] = useMemo(() => { | ||
}, []); | ||
const actualChildPropsSelector = usePureOnlyMemo(() => { | ||
const actualChildPropsSelector = useMemo(() => { | ||
const selector = () => { | ||
@@ -398,5 +393,4 @@ // Tricky logic here: | ||
return renderedChild; | ||
} // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed. | ||
} | ||
const _Connect = React.memo(ConnectFunction); | ||
@@ -403,0 +397,0 @@ |
@@ -38,6 +38,6 @@ import { useContext, useDebugValue } from 'react'; | ||
store, | ||
subscription, | ||
getServerState | ||
} = useReduxContext(); | ||
const selectedState = useSyncExternalStoreWithSelector(store.subscribe, store.getState, // TODO Need a server-side snapshot here | ||
getServerState || store.getState, selector, equalityFn); | ||
const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, selector, equalityFn); | ||
useDebugValue(selectedState); | ||
@@ -44,0 +44,0 @@ return selectedState; |
@@ -239,3 +239,2 @@ "use strict"; | ||
const selectorFactoryOptions = { | ||
pure, | ||
shouldHandleStateChanges, | ||
@@ -253,8 +252,4 @@ displayName, | ||
areMergedPropsEqual | ||
}; // If we aren't running in "pure" mode, we don't want to memoize values. | ||
// To avoid conditionally calling hooks, we fall back to a tiny wrapper | ||
// that just executes the given callback immediately. | ||
}; | ||
const usePureOnlyMemo = pure ? _react.useMemo : callback => callback(); | ||
function ConnectFunction(props) { | ||
@@ -339,3 +334,3 @@ const [propsContext, reactReduxForwardedRef, wrapperProps] = (0, _react.useMemo)(() => { | ||
}, []); | ||
const actualChildPropsSelector = usePureOnlyMemo(() => { | ||
const actualChildPropsSelector = (0, _react.useMemo)(() => { | ||
const selector = () => { | ||
@@ -424,5 +419,4 @@ // Tricky logic here: | ||
return renderedChild; | ||
} // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed. | ||
} | ||
const _Connect = _react.default.memo(ConnectFunction); | ||
@@ -429,0 +423,0 @@ |
@@ -51,6 +51,6 @@ "use strict"; | ||
store, | ||
subscription, | ||
getServerState | ||
} = useReduxContext(); | ||
const selectedState = useSyncExternalStoreWithSelector(store.subscribe, store.getState, // TODO Need a server-side snapshot here | ||
getServerState || store.getState, selector, equalityFn); | ||
const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, selector, equalityFn); | ||
(0, _react.useDebugValue)(selectedState); | ||
@@ -57,0 +57,0 @@ return selectedState; |
{ | ||
"name": "react-redux", | ||
"version": "8.0.0-beta.2", | ||
"version": "8.0.0-beta.3", | ||
"description": "Official React bindings for Redux", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
import { useContext, useDebugValue } from 'react' | ||
import { useContext, useDebugValue, useCallback } from 'react' | ||
@@ -51,8 +51,7 @@ import { useReduxContext as useDefaultReduxContext } from './useReduxContext' | ||
const { store, getServerState } = useReduxContext()! | ||
const { store, subscription, getServerState } = useReduxContext()! | ||
const selectedState = useSyncExternalStoreWithSelector( | ||
store.subscribe, | ||
subscription.addNestedSub, | ||
store.getState, | ||
// TODO Need a server-side snapshot here | ||
getServerState || store.getState, | ||
@@ -59,0 +58,0 @@ selector, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
306441
6428