react-redux
Advanced tools
Comparing version 8.0.0-alpha.0 to 8.0.0-alpha.1
@@ -9,2 +9,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,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(t);const u=o.default.createContext(null);let c=function(e){e()};const s=()=>c;const a={notify(){},get:()=>[]};function i(e,t){let n,r=a;function o(){c.onStateChange&&c.onStateChange()}function u(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){const e=s();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const c={addNestedSub:function(e){return u(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return!!n},trySubscribe:u,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=a)},getListeners:()=>r};return c}const f="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function l(){return(l=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function p(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;u.length>r;r++)0>t.indexOf(n=u[r])&&(o[n]=e[n]);return o}function d(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")} | ||
* LICENSE file in the root directory of this source tree. | ||
*/()}},n.exports),n.exports}var y="function"==typeof Symbol&&Symbol.for,m=y?Symbol.for("react.element"):60103,b=y?Symbol.for("react.portal"):60106,S=y?Symbol.for("react.fragment"):60107,v=y?Symbol.for("react.strict_mode"):60108,h=y?Symbol.for("react.profiler"):60114,g=y?Symbol.for("react.provider"):60109,P=y?Symbol.for("react.context"):60110,w=y?Symbol.for("react.async_mode"):60111,x=y?Symbol.for("react.concurrent_mode"):60111,O=y?Symbol.for("react.forward_ref"):60112,E=y?Symbol.for("react.suspense"):60113,M=y?Symbol.for("react.suspense_list"):60120,$=y?Symbol.for("react.memo"):60115,C=y?Symbol.for("react.lazy"):60116,j=y?Symbol.for("react.block"):60121,R=y?Symbol.for("react.fundamental"):60117,T=y?Symbol.for("react.responder"):60118,q=y?Symbol.for("react.scope"):60119;function N(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case m:switch(e=e.type){case w:case x:case S:case h:case v:case E:return e;default:switch(e=e&&e.$$typeof){case P:case O:case C:case $:case g:return e;default:return t}}case b:return t}}}function D(e){return N(e)===x}var k={AsyncMode:w,ConcurrentMode:x,ContextConsumer:P,ContextProvider:g,Element:m,ForwardRef:O,Fragment:S,Lazy:C,Memo:$,Portal:b,Profiler:h,StrictMode:v,Suspense:E,isAsyncMode:function(e){return D(e)||N(e)===w},isConcurrentMode:D,isContextConsumer:function(e){return N(e)===P},isContextProvider:function(e){return N(e)===g},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===m},isForwardRef:function(e){return N(e)===O},isFragment:function(e){return N(e)===S},isLazy:function(e){return N(e)===C},isMemo:function(e){return N(e)===$},isPortal:function(e){return N(e)===b},isProfiler:function(e){return N(e)===h},isStrictMode:function(e){return N(e)===v},isSuspense:function(e){return N(e)===E},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===S||e===x||e===h||e===v||e===E||e===M||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===$||e.$$typeof===g||e.$$typeof===P||e.$$typeof===O||e.$$typeof===R||e.$$typeof===T||e.$$typeof===q||e.$$typeof===j)},typeOf:N},F=d((function(e){e.exports=k})),_={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},V={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},L={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},U={};function H(e){return F.isMemo(e)?L:U[e.$$typeof]||_}U[F.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},U[F.Memo]=L;var W=Object.defineProperty,z=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols,I=Object.getOwnPropertyDescriptor,B=Object.getPrototypeOf,G=Object.prototype;var J=function e(t,n,r){if("string"!=typeof n){if(G){var o=B(n);o&&o!==G&&e(t,o,r)}var u=z(n);A&&(u=u.concat(A(n)));for(var c=H(t),s=H(n),a=0;u.length>a;++a){var i=u[a];if(!(V[i]||r&&r[i]||s&&s[i]||c&&c[i])){var f=I(n,i);try{W(t,i,f)}catch(e){}}}}return t},K=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement);var Q="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},X=o.default.useState,Y=o.default.useEffect,Z=o.default.useLayoutEffect,ee=o.default.useDebugValue;function te(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Q(e,n)}catch(e){return!0}}var ne=o.default.unstable_useSyncExternalStore,re={useSyncExternalStore:void 0!==ne?ne:K?function(e,t){var n=t(),r=X({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return Z((function(){o.value=n,o.getSnapshot=t,te(o)&&u({inst:o})}),[e,n,t]),Y((function(){return te(o)&&u({inst:o}),e((function(){te(o)&&u({inst:o})}))}),[e]),ee(n),n}:function(e,t){return t()}},oe=d((function(e){e.exports=re}));const ue=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function ce(e,t,n,r,{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(r,a)),l=n(i,f,a),l):y?(e.dependsOnOwnProps&&(i=e(s,a)),t.dependsOnOwnProps&&(f=t(r,a)),l=n(i,f,a),l):m?function(){const t=e(s,a),r=!c(t,i);return i=t,r&&(l=n(i,f,a)),l}():l}return function(o,u){return p?d(o,u):(s=o,a=u,i=e(s,a),f=t(r,a),l=n(i,f,a),p=!0,l)}}function se(e){return function(t){const n=e(t);function r(){return n}return r.dependsOnOwnProps=!1,r}}function ae(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function ie(e,t){return function(t,{}){const n=function(e,t){return n.mapToProps(e,n.dependsOnOwnProps?t:void 0)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=ae(e);let o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=ae(o),o=n(t,r)),o},n}}var fe=[function(e){return"function"==typeof e?ie(e):void 0},function(e){return e?void 0:se((e=>({dispatch:e})))},function(e){return e&&"object"==typeof e?se((t=>function(e,t){const n={};for(const r in e){const o=e[r];"function"==typeof o&&(n[r]=(...e)=>t(o(...e)))}return n}(e,t))):void 0}];var le=[function(e){return"function"==typeof e?ie(e):void 0},function(e){return e?void 0:se((()=>({})))}];function pe(e,t,n){return l({},n,e,t)}var de=[function(e){return"function"==typeof e?function(e){return function(t,{areMergedPropsEqual:n}){let r,o=!1;return function(t,u,c){const s=e(t,u,c);return o?n(s,r)||(r=s):(o=!0,r=s),r}}}(e):void 0},function(e){return e?void 0:()=>pe}];function ye(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function me(e,t){if(ye(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;n.length>r;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!ye(e[n[r]],t[n[r]]))return!1;return!0}const be=["reactReduxForwardedRef"],Se=[null,null];function ve(e,t,n,r,o,u){e.current=r,n.current=!1,o.current&&(o.current=null,u())}function he(e,t,n){for(let n=t.length-1;n>=0;n--){const r=t[n](e);if(r)return r}return(t,r)=>{throw Error(`Invalid value of type ${typeof e} for ${n} argument when connecting component ${r.wrappedComponentName}.`)}}function ge(e,t){return e===t}function Pe(){return t.useContext(u)}function we(e=u){const n=e===u?Pe:()=>t.useContext(e);return function(){const{store:e}=n();return e}}const xe=we();function Oe(e=u){const t=e===u?xe:we(e);return function(){return t().dispatch}}const Ee=Oe();var Me="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},$e=o.default.useRef,Ce=o.default.useEffect,je=o.default.useMemo,Re=o.default.useDebugValue,Te={useSyncExternalStoreExtra:function(e,t,n,r,o){var u=$e(null);if(null===u.current){var c={hasValue:!1,value:null};u.current=c}else c=u.current;u=je((function(){function e(e){if(!a){a=!0,u=e;var t=r(e);return s=void 0!==o&&c.hasValue&&o(e=c.value,t)?e:t}return t=s,Me(u,e)?t:(u=e,e=r(e),void 0!==o&&o(t,e)?t:s=e)}var u,s,a=!1,i=void 0===n?null:n;return[function(){return e(t())},null===i?void 0:function(){return e(i())}]}),[t,n,r,o]);var s=oe.useSyncExternalStore(e,u[0],u[1]);return Ce((function(){c.hasValue=!0,c.value=s}),[s]),Re(s),s}},qe=d((function(e){e.exports=Te}));const Ne=(e,t)=>e===t;function De(e=u){const n=e===u?Pe:()=>t.useContext(e);return function(e,r=Ne){const{store:o}=n(),u=qe.useSyncExternalStoreExtra(o.subscribe,o.getState,o.getState,e,r);return t.useDebugValue(u),u}}const ke=De();c=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=function({store:e,context:n,children:r}){const c=t.useMemo((()=>{const t=i(e);return{store:e,subscription:t}}),[e]),s=t.useMemo((()=>e.getState()),[e]);return f((()=>{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((n||u).Provider,{value:c},r)},e.ReactReduxContext=u,e.connect=function(e,n,r,{pure:c,areStatesEqual:s=ge,areOwnPropsEqual:a=me,areStatePropsEqual:d=me,areMergedPropsEqual:y=me,forwardRef:m=!1,context:b=u}={}){const S=b,v=he(e,le,"mapStateToProps"),h=he(n,fe,"mapDispatchToProps"),g=he(r,de,"mergeProps"),P=!!e;return e=>{const n=e.displayName||e.name||"Component",r=`Connect(${n})`,u={pure:c,shouldHandleStateChanges:P,displayName:r,wrappedComponentName:n,WrappedComponent:e,initMapStateToProps:v,initMapDispatchToProps:h,initMergeProps:g,areStatesEqual:s,areStatePropsEqual:d,areOwnPropsEqual:a,areMergedPropsEqual:y},b=c?t.useMemo:e=>e();function w(n){const[r,c,s]=t.useMemo((()=>{const{reactReduxForwardedRef:e}=n,t=p(n,be);return[n.context,e,t]}),[n]),a=t.useMemo((()=>r&&r.Consumer&&F.isContextConsumer(o.default.createElement(r.Consumer,null))?r:S),[r,S]),d=t.useContext(a),y=!!n.store&&!!n.store.getState&&!!n.store.dispatch,m=y?n.store:d.store,v=t.useMemo((()=>function(e,t){let{initMapStateToProps:n,initMapDispatchToProps:r,initMergeProps:o}=t,u=p(t,ue);return ce(n(e,u),r(e,u),o(e,u),e,u)}(m.dispatch,u)),[m]),[h,g]=t.useMemo((()=>{if(!P)return Se;const e=i(m,y?void 0:d.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[m,y,d]),w=t.useMemo((()=>y?d:l({},d,{subscription:h})),[y,d,h]),x=t.useRef(),O=t.useRef(s),E=t.useRef(),M=t.useRef(!1);t.useRef(!1);const $=t.useRef(!1),C=t.useRef();f((()=>($.current=!0,()=>{$.current=!1})),[]);const j=b((()=>()=>E.current&&s===O.current?E.current:v(m.getState(),s)),[m,s]),R=t.useMemo((()=>e=>h?function(e,t,n,r,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 n,d;try{n=r(e,o.current)}catch(e){d=e,p=e}d||(p=null),n===u.current?c.current||i():(u.current=n,a.current=n,c.current=!0,f())};return n.onStateChange=d,n.trySubscribe(),d(),()=>{if(l=!0,n.tryUnsubscribe(),n.onStateChange=null,p)throw p}}(P,m,h,v,O,x,M,$,E,g,e):()=>{}),[h]);var T,q,N;let D;T=ve,q=[O,x,M,s,E,g],f((()=>T(...q)),N);try{D=oe.useSyncExternalStore(R,j,j)}catch(e){throw C.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${C.current.stack}\n\n`),e}f((()=>{C.current=void 0,E.current=void 0,x.current=D}));const k=t.useMemo((()=>o.default.createElement(e,l({},D,{ref:c}))),[c,e,D]);return t.useMemo((()=>P?o.default.createElement(a.Provider,{value:w},k):k),[a,k,w])}const x=o.default.memo(w);if(x.WrappedComponent=e,x.displayName=w.displayName=r,m){const t=o.default.forwardRef((function(e,t){return o.default.createElement(x,l({},e,{reactReduxForwardedRef:t}))}));return t.displayName=r,t.WrappedComponent=e,J(t,e)}return J(x,e)}},e.createDispatchHook=Oe,e.createSelectorHook=De,e.createStoreHook=we,e.shallowEqual=me,e.useDispatch=Ee,e.useSelector=ke,e.useStore=xe,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/()}},n.exports),n.exports}var y="function"==typeof Symbol&&Symbol.for,m=y?Symbol.for("react.element"):60103,b=y?Symbol.for("react.portal"):60106,S=y?Symbol.for("react.fragment"):60107,v=y?Symbol.for("react.strict_mode"):60108,h=y?Symbol.for("react.profiler"):60114,P=y?Symbol.for("react.provider"):60109,g=y?Symbol.for("react.context"):60110,O=y?Symbol.for("react.async_mode"):60111,x=y?Symbol.for("react.concurrent_mode"):60111,w=y?Symbol.for("react.forward_ref"):60112,M=y?Symbol.for("react.suspense"):60113,$=y?Symbol.for("react.suspense_list"):60120,C=y?Symbol.for("react.memo"):60115,E=y?Symbol.for("react.lazy"):60116,j=y?Symbol.for("react.block"):60121,R=y?Symbol.for("react.fundamental"):60117,T=y?Symbol.for("react.responder"):60118,q=y?Symbol.for("react.scope"):60119;function N(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case m:switch(e=e.type){case O:case x:case S:case h:case v:case M:return e;default:switch(e=e&&e.$$typeof){case g:case w:case E:case C:case P:return e;default:return t}}case b:return t}}}function D(e){return N(e)===x}var k={AsyncMode:O,ConcurrentMode:x,ContextConsumer:g,ContextProvider:P,Element:m,ForwardRef:w,Fragment:S,Lazy:E,Memo:C,Portal:b,Profiler:h,StrictMode:v,Suspense:M,isAsyncMode:function(e){return D(e)||N(e)===O},isConcurrentMode:D,isContextConsumer:function(e){return N(e)===g},isContextProvider:function(e){return N(e)===P},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===m},isForwardRef:function(e){return N(e)===w},isFragment:function(e){return N(e)===S},isLazy:function(e){return N(e)===E},isMemo:function(e){return N(e)===C},isPortal:function(e){return N(e)===b},isProfiler:function(e){return N(e)===h},isStrictMode:function(e){return N(e)===v},isSuspense:function(e){return N(e)===M},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===S||e===x||e===h||e===v||e===M||e===$||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===C||e.$$typeof===P||e.$$typeof===g||e.$$typeof===w||e.$$typeof===R||e.$$typeof===T||e.$$typeof===q||e.$$typeof===j)},typeOf:N},F=d((function(e){e.exports=k})),_={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},V={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},W={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},U={};function H(e){return F.isMemo(e)?W:U[e.$$typeof]||_}U[F.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},U[F.Memo]=W;var L=Object.defineProperty,z=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols,I=Object.getOwnPropertyDescriptor,B=Object.getPrototypeOf,G=Object.prototype;var J=function e(t,n,r){if("string"!=typeof n){if(G){var o=B(n);o&&o!==G&&e(t,o,r)}var u=z(n);A&&(u=u.concat(A(n)));for(var c=H(t),s=H(n),a=0;u.length>a;++a){var i=u[a];if(!(V[i]||r&&r[i]||s&&s[i]||c&&c[i])){var f=I(n,i);try{L(t,i,f)}catch(e){}}}}return t};const K=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function Q(e,t,n,r,{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(r,a)),l=n(i,f,a),l):y?(e.dependsOnOwnProps&&(i=e(s,a)),t.dependsOnOwnProps&&(f=t(r,a)),l=n(i,f,a),l):m?function(){const t=e(s,a),r=!c(t,i);return i=t,r&&(l=n(i,f,a)),l}():l}return function(o,u){return p?d(o,u):(s=o,a=u,i=e(s,a),f=t(r,a),l=n(i,f,a),p=!0,l)}}function X(e){return function(t){const n=e(t);function r(){return n}return r.dependsOnOwnProps=!1,r}}function Y(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function Z(e,t){return function(t,{}){const n=function(e,t){return n.mapToProps(e,n.dependsOnOwnProps?t:void 0)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=Y(e);let o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=Y(o),o=n(t,r)),o},n}}var ee=[function(e){return"function"==typeof e?Z(e):void 0},function(e){return e?void 0:X((e=>({dispatch:e})))},function(e){return e&&"object"==typeof e?X((t=>function(e,t){const n={};for(const r in e){const o=e[r];"function"==typeof o&&(n[r]=(...e)=>t(o(...e)))}return n}(e,t))):void 0}];var te=[function(e){return"function"==typeof e?Z(e):void 0},function(e){return e?void 0:X((()=>({})))}];function ne(e,t,n){return l({},n,e,t)}var re=[function(e){return"function"==typeof e?function(e){return function(t,{areMergedPropsEqual:n}){let r,o=!1;return function(t,u,c){const s=e(t,u,c);return o?n(s,r)||(r=s):(o=!0,r=s),r}}}(e):void 0},function(e){return e?void 0:()=>ne}];function oe(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ue(e,t){if(oe(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;n.length>r;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!oe(e[n[r]],t[n[r]]))return!1;return!0}const ce=["reactReduxForwardedRef"],se=[null,null];function ae(e,t,n,r,o,u){e.current=r,n.current=!1,o.current&&(o.current=null,u())}function ie(e,t,n){for(let n=t.length-1;n>=0;n--){const r=t[n](e);if(r)return r}return(t,r)=>{throw Error(`Invalid value of type ${typeof e} for ${n} argument when connecting component ${r.wrappedComponentName}.`)}}function fe(e,t){return e===t}function le(){return t.useContext(u)}function pe(e=u){const n=e===u?le:()=>t.useContext(e);return function(){const{store:e}=n();return e}}const de=pe();function ye(e=u){const t=e===u?de:pe(e);return function(){return t().dispatch}}const me=ye();var be="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Se=o.default.useSyncExternalStore,ve=o.default.useRef,he=o.default.useEffect,Pe=o.default.useMemo,ge=o.default.useDebugValue,Oe={useSyncExternalStoreWithSelector:function(e,t,n,r,o){var u=ve(null);if(null===u.current){var c={hasValue:!1,value:null};u.current=c}else c=u.current;u=Pe((function(){function e(e){if(!a){if(a=!0,u=e,e=r(e),void 0!==o&&c.hasValue){var t=c.value;if(o(t,e))return s=t}return s=e}if(t=s,be(u,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(u=e,s=n)}var u,s,a=!1,i=void 0===n?null:n;return[function(){return e(t())},null===i?void 0:function(){return e(i())}]}),[t,n,r,o]);var s=Se(e,u[0],u[1]);return he((function(){c.hasValue=!0,c.value=s}),[s]),ge(s),s}},xe=d((function(e){e.exports=Oe}));const we=(e,t)=>e===t;function Me(e=u){const n=e===u?le:()=>t.useContext(e);return function(e,r=we){const{store:o}=n(),u=xe.useSyncExternalStoreWithSelector(o.subscribe,o.getState,o.getState,e,r);return t.useDebugValue(u),u}}const $e=Me();c=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=function({store:e,context:n,children:r}){const c=t.useMemo((()=>{const t=i(e);return{store:e,subscription:t}}),[e]),s=t.useMemo((()=>e.getState()),[e]);return f((()=>{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((n||u).Provider,{value:c},r)},e.ReactReduxContext=u,e.connect=function(e,n,r,{pure:c,areStatesEqual:s=fe,areOwnPropsEqual:a=ue,areStatePropsEqual:d=ue,areMergedPropsEqual:y=ue,forwardRef:m=!1,context:b=u}={}){const S=b,v=ie(e,te,"mapStateToProps"),h=ie(n,ee,"mapDispatchToProps"),P=ie(r,re,"mergeProps"),g=!!e;return e=>{const n=e.displayName||e.name||"Component",r=`Connect(${n})`,u={pure:c,shouldHandleStateChanges:g,displayName:r,wrappedComponentName:n,WrappedComponent:e,initMapStateToProps:v,initMapDispatchToProps:h,initMergeProps:P,areStatesEqual:s,areStatePropsEqual:d,areOwnPropsEqual:a,areMergedPropsEqual:y},b=c?t.useMemo:e=>e();function O(n){const[r,c,s]=t.useMemo((()=>{const{reactReduxForwardedRef:e}=n,t=p(n,ce);return[n.context,e,t]}),[n]),a=t.useMemo((()=>r&&r.Consumer&&F.isContextConsumer(o.default.createElement(r.Consumer,null))?r:S),[r,S]),d=t.useContext(a),y=!!n.store&&!!n.store.getState&&!!n.store.dispatch,m=y?n.store:d.store,v=t.useMemo((()=>function(e,t){let{initMapStateToProps:n,initMapDispatchToProps:r,initMergeProps:o}=t,u=p(t,K);return Q(n(e,u),r(e,u),o(e,u),e,u)}(m.dispatch,u)),[m]),[h,P]=t.useMemo((()=>{if(!g)return se;const e=i(m,y?void 0:d.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[m,y,d]),O=t.useMemo((()=>y?d:l({},d,{subscription:h})),[y,d,h]),x=t.useRef(),w=t.useRef(s),M=t.useRef(),$=t.useRef(!1);t.useRef(!1);const C=t.useRef(!1),E=t.useRef();f((()=>(C.current=!0,()=>{C.current=!1})),[]);const j=b((()=>()=>M.current&&s===w.current?M.current:v(m.getState(),s)),[m,s]),R=t.useMemo((()=>e=>h?function(e,t,n,r,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 n,d;try{n=r(e,o.current)}catch(e){d=e,p=e}d||(p=null),n===u.current?c.current||i():(u.current=n,a.current=n,c.current=!0,f())};return n.onStateChange=d,n.trySubscribe(),d(),()=>{if(l=!0,n.tryUnsubscribe(),n.onStateChange=null,p)throw p}}(g,m,h,v,w,x,$,C,M,P,e):()=>{}),[h]);var T,q,N;let D;T=ae,q=[w,x,$,s,M,P],f((()=>T(...q)),N);try{D=t.useSyncExternalStore(R,j,j)}catch(e){throw E.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${E.current.stack}\n\n`),e}f((()=>{E.current=void 0,M.current=void 0,x.current=D}));const k=t.useMemo((()=>o.default.createElement(e,l({},D,{ref:c}))),[c,e,D]);return t.useMemo((()=>g?o.default.createElement(a.Provider,{value:O},k):k),[a,k,O])}const x=o.default.memo(O);if(x.WrappedComponent=e,x.displayName=O.displayName=r,m){const t=o.default.forwardRef((function(e,t){return o.default.createElement(x,l({},e,{reactReduxForwardedRef:t}))}));return t.displayName=r,t.WrappedComponent=e,J(t,e)}return J(x,e)}},e.createDispatchHook=ye,e.createSelectorHook=Me,e.createStoreHook=pe,e.shallowEqual=ue,e.useDispatch=me,e.useSelector=$e,e.useStore=de,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -7,5 +7,5 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import hoistStatics from 'hoist-non-react-statics'; | ||
import React, { useContext, useMemo, useRef } from 'react'; | ||
import React, { useContext, useMemo, useRef, // @ts-ignore | ||
useSyncExternalStore } from 'react'; | ||
import { isValidElementType, isContextConsumer } from 'react-is'; | ||
import { useSyncExternalStore } from 'use-sync-external-store'; | ||
import defaultSelectorFactory from '../connect/selectorFactory'; | ||
@@ -12,0 +12,0 @@ import defaultMapDispatchToPropsFactories from '../connect/mapDispatchToProps'; |
@@ -1,3 +0,4 @@ | ||
import { useContext, useDebugValue } from 'react'; | ||
import { useSyncExternalStoreExtra } from 'use-sync-external-store/extra'; | ||
import { useContext, useDebugValue } from 'react'; // @ts-ignore | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'; | ||
import { useReduxContext as useDefaultReduxContext } from './useReduxContext'; | ||
@@ -35,3 +36,3 @@ import { ReactReduxContext } from '../components/Context'; | ||
} = useReduxContext(); | ||
const selectedState = useSyncExternalStoreExtra(store.subscribe, store.getState, // TODO Need a server-side snapshot here | ||
const selectedState = useSyncExternalStoreWithSelector(store.subscribe, store.getState, // TODO Need a server-side snapshot here | ||
store.getState, selector, equalityFn); | ||
@@ -38,0 +39,0 @@ useDebugValue(selectedState); |
@@ -18,4 +18,2 @@ "use strict"; | ||
var _useSyncExternalStore = require("use-sync-external-store"); | ||
var _selectorFactory = _interopRequireDefault(require("../connect/selectorFactory")); | ||
@@ -368,3 +366,3 @@ | ||
try { | ||
actualChildProps = (0, _useSyncExternalStore.useSyncExternalStore)(subscribeForReact, actualChildPropsSelector, // TODO Need a real getServerSnapshot here | ||
actualChildProps = (0, _react.useSyncExternalStore)(subscribeForReact, actualChildPropsSelector, // TODO Need a real getServerSnapshot here | ||
actualChildPropsSelector); | ||
@@ -371,0 +369,0 @@ } catch (err) { |
@@ -9,3 +9,3 @@ "use strict"; | ||
var _extra = require("use-sync-external-store/extra"); | ||
var _withSelector = require("use-sync-external-store/with-selector"); | ||
@@ -16,2 +16,3 @@ var _useReduxContext = require("./useReduxContext"); | ||
// @ts-ignore | ||
const refEquality = (a, b) => a === b; | ||
@@ -46,3 +47,3 @@ /** | ||
} = useReduxContext(); | ||
const selectedState = (0, _extra.useSyncExternalStoreExtra)(store.subscribe, store.getState, // TODO Need a server-side snapshot here | ||
const selectedState = (0, _withSelector.useSyncExternalStoreWithSelector)(store.subscribe, store.getState, // TODO Need a server-side snapshot here | ||
store.getState, selector, equalityFn); | ||
@@ -49,0 +50,0 @@ (0, _react.useDebugValue)(selectedState); |
{ | ||
"name": "react-redux", | ||
"version": "8.0.0-alpha.0", | ||
"version": "8.0.0-alpha.1", | ||
"description": "Official React bindings for Redux", | ||
@@ -34,4 +34,4 @@ "keywords": [ | ||
"api-types": "api-extractor run --local", | ||
"format": "prettier --write \"{src,test}/**/*.{js,ts}\" \"docs/**/*.md\"", | ||
"lint": "eslint src --ext ts,js test/utils test/components test/hooks", | ||
"format": "prettier --write \"{src,test}/**/*.{js,ts,tsx}\" \"docs/**/*.md\"", | ||
"lint": "eslint src --ext ts,tsx,js test/utils test/components test/hooks", | ||
"prepare": "yarn clean && yarn build", | ||
@@ -44,3 +44,3 @@ "pretest": "yarn lint", | ||
"peerDependencies": { | ||
"react": "^16.8.3 || ^17 || ^18" | ||
"react": "^18.0.0-alpha || ^18.0.0-beta" | ||
}, | ||
@@ -61,5 +61,4 @@ "peerDependenciesMeta": { | ||
"loose-envify": "^1.4.0", | ||
"prop-types": "^15.7.2", | ||
"react-is": "^16.13.1", | ||
"use-sync-external-store": "0.0.0-experimental-7d38e4fd8-20210930" | ||
"use-sync-external-store": "1.0.0-alpha-5cccacd13-20211101" | ||
}, | ||
@@ -84,3 +83,3 @@ "devDependencies": { | ||
"@testing-library/jest-native": "^3.4.3", | ||
"@testing-library/react": "https://pkg.csb.dev/testing-library/react-testing-library/commit/0e2cf7da/@testing-library/react#.tgz", | ||
"@testing-library/react": "13.0.0-alpha.4", | ||
"@testing-library/react-hooks": "^3.4.2", | ||
@@ -111,6 +110,6 @@ "@testing-library/react-native": "^7.1.0", | ||
"prettier": "^2.1.2", | ||
"react": "0.0.0-experimental-7d38e4fd8-20210930", | ||
"react-dom": "0.0.0-experimental-7d38e4fd8-20210930", | ||
"react": "18.0.0-alpha-5cccacd13-20211101", | ||
"react-dom": "18.0.0-alpha-5cccacd13-20211101", | ||
"react-native": "^0.64.1", | ||
"react-test-renderer": "0.0.0-experimental-7d38e4fd8-20210930", | ||
"react-test-renderer": "18.0.0-alpha-5cccacd13-20211101", | ||
"redux": "^4.0.5", | ||
@@ -117,0 +116,0 @@ "rimraf": "^3.0.2", |
@@ -1,2 +0,2 @@ | ||
import { Action, ActionCreator, AnyAction, Dispatch, Store } from 'redux' | ||
import { Action, AnyAction, Dispatch } from 'redux' | ||
import { Context } from 'react' | ||
@@ -3,0 +3,0 @@ |
import { useContext, useDebugValue } from 'react' | ||
import { useSyncExternalStoreExtra } from 'use-sync-external-store/extra' | ||
// @ts-ignore | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector' | ||
@@ -48,3 +49,3 @@ import { useReduxContext as useDefaultReduxContext } from './useReduxContext' | ||
const selectedState = useSyncExternalStoreExtra( | ||
const selectedState = useSyncExternalStoreWithSelector( | ||
store.subscribe, | ||
@@ -51,0 +52,0 @@ store.getState, |
/* eslint-disable no-unused-vars */ | ||
// TODO Ignoring all unused variables for now | ||
import { | ||
ClassAttributes, | ||
Component, | ||
ComponentClass, | ||
ComponentType, | ||
StatelessComponent, | ||
Context, | ||
NamedExoticComponent, | ||
} from 'react' | ||
import { ClassAttributes, ComponentClass, ComponentType } from 'react' | ||
import { Action, ActionCreator, AnyAction, Dispatch, Store } from 'redux' | ||
import { Action, AnyAction, Dispatch } from 'redux' | ||
@@ -16,0 +8,0 @@ // import hoistNonReactStatics = require('hoist-non-react-statics'); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8
0
287296
117
6140
+ Addedreact@18.0.0-alpha-5cccacd13-20211101(transitive)
+ Addeduse-sync-external-store@1.0.0-alpha-5cccacd13-20211101(transitive)
- Removedprop-types@^15.7.2
- Removedprop-types@15.8.1(transitive)
- Removedreact@0.0.0-experimental-7d38e4fd8-20210930(transitive)
- Removeduse-sync-external-store@0.0.0-experimental-7d38e4fd8-20210930(transitive)
Updateduse-sync-external-store@1.0.0-alpha-5cccacd13-20211101