react-redux
Advanced tools
Comparing version 8.0.0-alpha.1 to 8.0.0-beta.0
@@ -1,9 +0,17 @@ | ||
!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")} | ||
!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}));const y=()=>{throw Error("Not initialize!")};let m=y,b=y;const S=()=>[m,b];let v=function(e){e()};const h=()=>v,g=o.default.createContext(null);const P={notify(){},get:()=>[]};function $(e,t){let r,n=P;function o(){c.onStateChange&&c.onStateChange()}function u(){r||(r=t?t.addNestedSub(o):e.subscribe(o),n=function(){const e=h();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=P)},getListeners:()=>n};return c}const w="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function x(){return(x=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 O(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 | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* 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,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})})); | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/var M="function"==typeof Symbol&&Symbol.for,C=M?Symbol.for("react.element"):60103,E=M?Symbol.for("react.portal"):60106,j=M?Symbol.for("react.fragment"):60107,R=M?Symbol.for("react.strict_mode"):60108,T=M?Symbol.for("react.profiler"):60114,N=M?Symbol.for("react.provider"):60109,q=M?Symbol.for("react.context"):60110,_=M?Symbol.for("react.async_mode"):60111,D=M?Symbol.for("react.concurrent_mode"):60111,F=M?Symbol.for("react.forward_ref"):60112,k=M?Symbol.for("react.suspense"):60113,L=M?Symbol.for("react.suspense_list"):60120,z=M?Symbol.for("react.memo"):60115,V=M?Symbol.for("react.lazy"):60116,W=M?Symbol.for("react.block"):60121,U=M?Symbol.for("react.fundamental"):60117,H=M?Symbol.for("react.responder"):60118,A=M?Symbol.for("react.scope"):60119;function I(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case C:switch(e=e.type){case _:case D:case j:case T:case R:case k:return e;default:switch(e=e&&e.$$typeof){case q:case F:case V:case z:case N:return e;default:return t}}case E:return t}}}function B(e){return I(e)===D}var G={AsyncMode:_,ConcurrentMode:D,ContextConsumer:q,ContextProvider:N,Element:C,ForwardRef:F,Fragment:j,Lazy:V,Memo:z,Portal:E,Profiler:T,StrictMode:R,Suspense:k,isAsyncMode:function(e){return B(e)||I(e)===_},isConcurrentMode:B,isContextConsumer:function(e){return I(e)===q},isContextProvider:function(e){return I(e)===N},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===C},isForwardRef:function(e){return I(e)===F},isFragment:function(e){return I(e)===j},isLazy:function(e){return I(e)===V},isMemo:function(e){return I(e)===z},isPortal:function(e){return I(e)===E},isProfiler:function(e){return I(e)===T},isStrictMode:function(e){return I(e)===R},isSuspense:function(e){return I(e)===k},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===j||e===D||e===T||e===R||e===k||e===L||"object"==typeof e&&null!==e&&(e.$$typeof===V||e.$$typeof===z||e.$$typeof===N||e.$$typeof===q||e.$$typeof===F||e.$$typeof===U||e.$$typeof===H||e.$$typeof===A||e.$$typeof===W)},typeOf:I},J=u((function(e){e.exports=G})),K={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Q={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},Y={};function Z(e){return J.isMemo(e)?X:Y[e.$$typeof]||K}Y[J.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Y[J.Memo]=X;var ee=Object.defineProperty,te=Object.getOwnPropertyNames,re=Object.getOwnPropertySymbols,ne=Object.getOwnPropertyDescriptor,oe=Object.getPrototypeOf,ue=Object.prototype;var ce=function e(t,r,n){if("string"!=typeof r){if(ue){var o=oe(r);o&&o!==ue&&e(t,o,n)}var u=te(r);re&&(u=u.concat(re(r)));for(var c=Z(t),s=Z(r),a=0;u.length>a;++a){var i=u[a];if(!(Q[i]||n&&n[i]||s&&s[i]||c&&c[i])){var f=ne(r,i);try{ee(t,i,f)}catch(e){}}}}return t},se=60103,ae=60106,ie=60107,fe=60108,le=60114,pe=60109,de=60110,ye=60112,me=60113,be=60120,Se=60115,ve=60116,he=60129,ge=60130,Pe=60131; | ||
/** @license React vundefined | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/if("function"==typeof Symbol&&Symbol.for){var $e=Symbol.for;se=$e("react.element"),ae=$e("react.portal"),ie=$e("react.fragment"),fe=$e("react.strict_mode"),le=$e("react.profiler"),pe=$e("react.provider"),de=$e("react.context"),ye=$e("react.forward_ref"),me=$e("react.suspense"),be=$e("react.suspense_list"),Se=$e("react.memo"),ve=$e("react.lazy"),he=$e("react.debug_trace_mode"),ge=$e("react.offscreen"),Pe=$e("react.legacy_hidden")}var we=0;function xe(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case se:switch(e=e.type){case ie:case le:case fe:case me:case be:return e;default:switch(e=e&&e.$$typeof){case de:case ye:case ve:case Se:case pe:return e;default:return t}}case ae:return t}}}"function"==typeof Symbol&&(we=Symbol.for("react.module.reference"));var Oe={ContextConsumer:de,ContextProvider:pe,Element:se,ForwardRef:ye,Fragment:ie,Lazy:ve,Memo:Se,Portal:ae,Profiler:le,StrictMode:fe,Suspense:me,SuspenseList:be,isAsyncMode:function(){return!1},isConcurrentMode:function(){return!1},isContextConsumer:function(e){return xe(e)===de},isContextProvider:function(e){return xe(e)===pe},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===se},isForwardRef:function(e){return xe(e)===ye},isFragment:function(e){return xe(e)===ie},isLazy:function(e){return xe(e)===ve},isMemo:function(e){return xe(e)===Se},isPortal:function(e){return xe(e)===ae},isProfiler:function(e){return xe(e)===le},isStrictMode:function(e){return xe(e)===fe},isSuspense:function(e){return xe(e)===me},isSuspenseList:function(e){return xe(e)===be},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===ie||e===le||e===he||e===fe||e===me||e===be||e===Pe||e===ge||"object"==typeof e&&null!==e&&(e.$$typeof===ve||e.$$typeof===Se||e.$$typeof===pe||e.$$typeof===de||e.$$typeof===ye||e.$$typeof===we||void 0!==e.getModuleId)},typeOf:xe},Me=u((function(e){e.exports=Oe}));const Ce=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function Ee(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 je(e){return function(t){const r=e(t);function n(){return r}return n.dependsOnOwnProps=!1,n}}function Re(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function Te(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=Re(e);let o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=Re(o),o=r(t,n)),o},r}}var Ne=[function(e){return"function"==typeof e?Te(e):void 0},function(e){return e?void 0:je((e=>({dispatch:e})))},function(e){return e&&"object"==typeof e?je((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?Te(e):void 0},function(e){return e?void 0:je((()=>({})))}];function _e(e,t,r){return x({},r,e,t)}var De=[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:()=>_e}];function Fe(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function ke(e,t){if(Fe(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])||!Fe(e[r[n]],t[r[n]]))return!1;return!0}const Le=["reactReduxForwardedRef"],[ze]=S(),Ve=[null,null];function We(e,t,r,n,o,u){e.current=n,r.current=!1,o.current&&(o.current=null,u())}function Ue(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 He(e,t){return e===t}function Ae(){return t.useContext(g)}function Ie(e=g){const r=e===g?Ae:()=>t.useContext(e);return function(){const{store:e}=r();return e}}const Be=Ie();function Ge(e=g){const t=e===g?Be:Ie(e);return function(){return t().dispatch}}const Je=Ge(),[,Ke]=S(),Qe=(e,t)=>e===t;function Xe(e=g){const r=e===g?Ae:()=>t.useContext(e);return function(e,n=Qe){const{store:o}=r(),u=Ke(o.subscribe,o.getState,o.getState,e,n);return t.useDebugValue(u),u}}const Ye=Xe();((e,t)=>{m=e,b=t})(t.useSyncExternalStore,d.useSyncExternalStoreWithSelector),v=r.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return r.unstable_batchedUpdates}}),e.Provider=function({store:e,context:r,children:n}){const u=t.useMemo((()=>{const t=$(e);return{store:e,subscription:t}}),[e]),c=t.useMemo((()=>e.getState()),[e]);return w((()=>{const{subscription:t}=u;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),c!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[u,c]),o.default.createElement((r||g).Provider,{value:u},n)},e.ReactReduxContext=g,e.connect=function(e,r,n,{pure:u,areStatesEqual:c=He,areOwnPropsEqual:s=ke,areStatePropsEqual:a=ke,areMergedPropsEqual:i=ke,forwardRef:f=!1,context:l=g}={}){const p=l,d=Ue(e,qe,"mapStateToProps"),y=Ue(r,Ne,"mapDispatchToProps"),m=Ue(n,De,"mergeProps"),b=!!e;return e=>{const r=e.displayName||e.name||"Component",n=`Connect(${r})`,l={pure:u,shouldHandleStateChanges:b,displayName:n,wrappedComponentName:r,WrappedComponent:e,initMapStateToProps:d,initMapDispatchToProps:y,initMergeProps:m,areStatesEqual:c,areStatePropsEqual:a,areOwnPropsEqual:s,areMergedPropsEqual:i},S=u?t.useMemo:e=>e();function v(r){const[n,u,c]=t.useMemo((()=>{const{reactReduxForwardedRef:e}=r,t=O(r,Le);return[r.context,e,t]}),[r]),s=t.useMemo((()=>n&&n.Consumer&&Me.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=t.useMemo((()=>function(e,t){let{initMapStateToProps:r,initMapDispatchToProps:n,initMergeProps:o}=t,u=O(t,Ce);return Ee(r(e,u),n(e,u),o(e,u),e,u)}(f.dispatch,l)),[f]),[y,m]=t.useMemo((()=>{if(!b)return Ve;const e=$(f,i?void 0:a.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[f,i,a]),v=t.useMemo((()=>i?a:x({},a,{subscription:y})),[i,a,y]),h=t.useRef(),g=t.useRef(c),P=t.useRef(),M=t.useRef(!1);t.useRef(!1);const C=t.useRef(!1),E=t.useRef();w((()=>(C.current=!0,()=>{C.current=!1})),[]);const j=S((()=>()=>P.current&&c===g.current?P.current:d(f.getState(),c)),[f,c]),R=t.useMemo((()=>e=>y?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}}(b,f,y,d,g,h,M,C,P,m,e):()=>{}),[y]);var T,N,q;let _;T=We,N=[g,h,M,c,P,m],w((()=>T(...N)),q);try{_=ze(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}w((()=>{E.current=void 0,P.current=void 0,h.current=_}));const D=t.useMemo((()=>o.default.createElement(e,x({},_,{ref:u}))),[u,e,_]);return t.useMemo((()=>b?o.default.createElement(s.Provider,{value:v},D):D),[s,D,v])}const h=o.default.memo(v);if(h.WrappedComponent=e,h.displayName=v.displayName=n,f){const t=o.default.forwardRef((function(e,t){return o.default.createElement(h,x({},e,{reactReduxForwardedRef:t}))}));return t.displayName=n,t.WrappedComponent=e,ce(t,e)}return ce(h,e)}},e.createDispatchHook=Ge,e.createSelectorHook=Xe,e.createStoreHook=Ie,e.shallowEqual=ke,e.useDispatch=Je,e.useSelector=Ye,e.useStore=Be,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -1,3 +0,3 @@ | ||
export * from './exports'; | ||
declare const batch: (callback: () => void) => void; | ||
export { batch }; | ||
export * from './exports'; |
@@ -1,2 +0,9 @@ | ||
export * from './exports'; | ||
// The "alternate renderers" entry point is primarily here to fall back on a no-op | ||
// version of `unstable_batchedUpdates`, for use with renderers other than ReactDOM/RN. | ||
// Examples include React-Three-Fiber, Ink, etc. | ||
// Because of that, we'll also assume the useSyncExternalStore compat shim is needed. | ||
import { useSyncExternalStore } from 'use-sync-external-store/shim'; | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'; | ||
import { setSyncFunctions } from './utils/useSyncExternalStore'; | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector); | ||
import { getBatch } from './utils/batch'; // For other renderers besides ReactDOM and React Native, | ||
@@ -6,2 +13,3 @@ // use the default noop batch function | ||
const batch = getBatch(); | ||
export { batch }; | ||
export { batch }; | ||
export * from './exports'; |
@@ -7,4 +7,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import hoistStatics from 'hoist-non-react-statics'; | ||
import React, { useContext, useMemo, useRef, // @ts-ignore | ||
useSyncExternalStore } from 'react'; | ||
import React, { useContext, useMemo, useRef } from 'react'; | ||
import { isValidElementType, isContextConsumer } from 'react-is'; | ||
@@ -17,4 +16,6 @@ import defaultSelectorFactory from '../connect/selectorFactory'; | ||
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'; | ||
import { getSyncFunctions } from '../utils/useSyncExternalStore'; | ||
import shallowEqual from '../utils/shallowEqual'; | ||
import { ReactReduxContext } from './Context'; // Define some constant arrays just to avoid re-creating these | ||
import { ReactReduxContext } from './Context'; | ||
const [useSyncExternalStore] = getSyncFunctions(); // Define some constant arrays just to avoid re-creating these | ||
@@ -21,0 +22,0 @@ const EMPTY_ARRAY = [null, 0]; |
import React from 'react'; | ||
import { Action, AnyAction, Store } from 'redux'; | ||
import type { Action, AnyAction, Store } from 'redux'; | ||
import type { Subscription } from '../utils/Subscription'; | ||
@@ -4,0 +4,0 @@ export interface ReactReduxContextValue<SS = any, A extends Action = AnyAction> { |
@@ -13,3 +13,3 @@ import type { ReactReduxContextValue } from '../components/Context'; | ||
* | ||
* export const CounterComponent = ({ value }) => { | ||
* export const CounterComponent = () => { | ||
* const { store } = useReduxContext() | ||
@@ -16,0 +16,0 @@ * return <div>{store.getState()}</div> |
@@ -15,3 +15,3 @@ import { useContext } from 'react'; | ||
* | ||
* export const CounterComponent = ({ value }) => { | ||
* export const CounterComponent = () => { | ||
* const { store } = useReduxContext() | ||
@@ -18,0 +18,0 @@ * return <div>{store.getState()}</div> |
/// <reference types="react" /> | ||
import { DefaultRootState, EqualityFn } from '../types'; | ||
import type { DefaultRootState, EqualityFn } from '../types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Hook factory, which creates a `useSelector` hook bound to a given context. |
@@ -1,6 +0,6 @@ | ||
import { useContext, useDebugValue } from 'react'; // @ts-ignore | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'; | ||
import { useContext, useDebugValue } from 'react'; | ||
import { useReduxContext as useDefaultReduxContext } from './useReduxContext'; | ||
import { ReactReduxContext } from '../components/Context'; | ||
import { getSyncFunctions } from '../utils/useSyncExternalStore'; | ||
const [, useSyncExternalStoreWithSelector] = getSyncFunctions(); | ||
@@ -7,0 +7,0 @@ const refEquality = (a, b) => a === b; |
@@ -1,3 +0,3 @@ | ||
export * from './exports'; | ||
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'; | ||
export { batch }; | ||
export * from './exports'; |
@@ -1,7 +0,16 @@ | ||
export * from './exports'; | ||
// The default entry point assumes we are working with React 18, and thus have | ||
// useSyncExternalStore available. We can import that directly from React itself. | ||
// The useSyncExternalStoreWithSelector has to be imported, but we can use the | ||
// non-shim version. This shaves off the byte size of the shim. | ||
// @ts-ignore React types not updated yet | ||
import { useSyncExternalStore } from 'react'; | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'; | ||
import { setSyncFunctions } from './utils/useSyncExternalStore'; | ||
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'; | ||
import { setBatch } from './utils/batch'; // Enable batched updates in our subscriptions for use | ||
import { setBatch } from './utils/batch'; | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector); // Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
setBatch(batch); | ||
export { batch }; | ||
export { batch }; | ||
export * from './exports'; |
@@ -9,2 +9,10 @@ "use strict"; | ||
var _shim = require("use-sync-external-store/shim"); | ||
var _withSelector = require("use-sync-external-store/shim/with-selector"); | ||
var _useSyncExternalStore = require("./utils/useSyncExternalStore"); | ||
var _batch = require("./utils/batch"); | ||
var _exports = require("./exports"); | ||
@@ -23,5 +31,7 @@ | ||
}); | ||
var _batch = require("./utils/batch"); | ||
// The "alternate renderers" entry point is primarily here to fall back on a no-op | ||
// version of `unstable_batchedUpdates`, for use with renderers other than ReactDOM/RN. | ||
// Examples include React-Three-Fiber, Ink, etc. | ||
// Because of that, we'll also assume the useSyncExternalStore compat shim is needed. | ||
(0, _useSyncExternalStore.setSyncFunctions)(_shim.useSyncExternalStore, _withSelector.useSyncExternalStoreWithSelector); | ||
// For other renderers besides ReactDOM and React Native, | ||
@@ -28,0 +38,0 @@ // use the default noop batch function |
@@ -30,2 +30,4 @@ "use strict"; | ||
var _useSyncExternalStore = require("../utils/useSyncExternalStore"); | ||
var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual")); | ||
@@ -41,3 +43,4 @@ | ||
// Define some constant arrays just to avoid re-creating these | ||
const [useSyncExternalStore] = (0, _useSyncExternalStore.getSyncFunctions)(); // Define some constant arrays just to avoid re-creating these | ||
const EMPTY_ARRAY = [null, 0]; | ||
@@ -367,3 +370,3 @@ const NO_SUBSCRIPTION_ARRAY = [null, null]; // Attempts to stringify whatever not-really-a-component value we were given | ||
try { | ||
actualChildProps = (0, _react.useSyncExternalStore)(subscribeForReact, actualChildPropsSelector, // TODO Need a real getServerSnapshot here | ||
actualChildProps = useSyncExternalStore(subscribeForReact, actualChildPropsSelector, // TODO Need a real getServerSnapshot here | ||
actualChildPropsSelector); | ||
@@ -370,0 +373,0 @@ } catch (err) { |
@@ -21,3 +21,3 @@ "use strict"; | ||
* | ||
* export const CounterComponent = ({ value }) => { | ||
* export const CounterComponent = () => { | ||
* const { store } = useReduxContext() | ||
@@ -24,0 +24,0 @@ * return <div>{store.getState()}</div> |
@@ -9,4 +9,2 @@ "use strict"; | ||
var _withSelector = require("use-sync-external-store/with-selector"); | ||
var _useReduxContext = require("./useReduxContext"); | ||
@@ -16,3 +14,6 @@ | ||
// @ts-ignore | ||
var _useSyncExternalStore = require("../utils/useSyncExternalStore"); | ||
const [, useSyncExternalStoreWithSelector] = (0, _useSyncExternalStore.getSyncFunctions)(); | ||
const refEquality = (a, b) => a === b; | ||
@@ -47,3 +48,3 @@ /** | ||
} = useReduxContext(); | ||
const selectedState = (0, _withSelector.useSyncExternalStoreWithSelector)(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); | ||
@@ -50,0 +51,0 @@ (0, _react.useDebugValue)(selectedState); |
@@ -14,2 +14,12 @@ "use strict"; | ||
var _react = require("react"); | ||
var _withSelector = require("use-sync-external-store/with-selector"); | ||
var _useSyncExternalStore = require("./utils/useSyncExternalStore"); | ||
var _reactBatchedUpdates = require("./utils/reactBatchedUpdates"); | ||
var _batch = require("./utils/batch"); | ||
var _exports = require("./exports"); | ||
@@ -28,9 +38,10 @@ | ||
}); | ||
// The default entry point assumes we are working with React 18, and thus have | ||
// useSyncExternalStore available. We can import that directly from React itself. | ||
// The useSyncExternalStoreWithSelector has to be imported, but we can use the | ||
// non-shim version. This shaves off the byte size of the shim. | ||
// @ts-ignore React types not updated yet | ||
(0, _useSyncExternalStore.setSyncFunctions)(_react.useSyncExternalStore, _withSelector.useSyncExternalStoreWithSelector); // Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
var _reactBatchedUpdates = require("./utils/reactBatchedUpdates"); | ||
var _batch = require("./utils/batch"); | ||
// Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
(0, _batch.setBatch)(_reactBatchedUpdates.unstable_batchedUpdates); |
{ | ||
"name": "react-redux", | ||
"version": "8.0.0-alpha.1", | ||
"version": "8.0.0-beta.0", | ||
"description": "Official React bindings for Redux", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"react": "^18.0.0-alpha || ^18.0.0-beta" | ||
"react": "^18.0.0-beta" | ||
}, | ||
@@ -56,8 +56,11 @@ "peerDependenciesMeta": { | ||
"@babel/runtime": "^7.12.1", | ||
"@testing-library/react-12": "npm:@testing-library/react@^12", | ||
"@types/hoist-non-react-statics": "^3.3.1", | ||
"@types/use-sync-external-store": "^0.0.0", | ||
"@types/use-sync-external-store": "^0.0.3", | ||
"hoist-non-react-statics": "^3.3.2", | ||
"loose-envify": "^1.4.0", | ||
"react-is": "^16.13.1", | ||
"use-sync-external-store": "1.0.0-alpha-5cccacd13-20211101" | ||
"react-17": "npm:react@^17", | ||
"react-dom-17": "npm:react-dom@^17", | ||
"react-is": "^18.0.0-beta-fdc1d617a-20211118", | ||
"react-test-renderer-17": "npm:react-test-renderer@^17", | ||
"use-sync-external-store": "1.0.0-beta-fdc1d617a-20211118" | ||
}, | ||
@@ -85,6 +88,5 @@ "devDependencies": { | ||
"@testing-library/react-native": "^7.1.0", | ||
"@types/create-react-class": "^15.6.3", | ||
"@types/object-assign": "^4.0.30", | ||
"@types/react": "17.0.19", | ||
"@types/react-dom": "^17.0.9", | ||
"@types/react": "^17.0.35", | ||
"@types/react-dom": "^17.0.11", | ||
"@types/react-is": "^17.0.1", | ||
@@ -98,5 +100,3 @@ "@types/react-native": "^0.64.12", | ||
"codecov": "^3.8.0", | ||
"create-react-class": "^15.7.0", | ||
"cross-env": "^7.0.2", | ||
"es3ify": "^0.2.0", | ||
"eslint": "^7.12.0", | ||
@@ -110,6 +110,6 @@ "eslint-config-prettier": "^6.14.0", | ||
"prettier": "^2.1.2", | ||
"react": "18.0.0-alpha-5cccacd13-20211101", | ||
"react-dom": "18.0.0-alpha-5cccacd13-20211101", | ||
"react": "18.0.0-beta-fdc1d617a-20211118", | ||
"react-dom": "18.0.0-beta-fdc1d617a-20211118", | ||
"react-native": "^0.64.1", | ||
"react-test-renderer": "18.0.0-alpha-5cccacd13-20211101", | ||
"react-test-renderer": "18.0.0-beta-fdc1d617a-20211118", | ||
"redux": "^4.0.5", | ||
@@ -121,8 +121,3 @@ "rimraf": "^3.0.2", | ||
"typescript": "^4.3.4" | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"loose-envify" | ||
] | ||
} | ||
} |
@@ -1,3 +0,13 @@ | ||
export * from './exports' | ||
// The "alternate renderers" entry point is primarily here to fall back on a no-op | ||
// version of `unstable_batchedUpdates`, for use with renderers other than ReactDOM/RN. | ||
// Examples include React-Three-Fiber, Ink, etc. | ||
// Because of that, we'll also assume the useSyncExternalStore compat shim is needed. | ||
import { useSyncExternalStore } from 'use-sync-external-store/shim' | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector' | ||
import { setSyncFunctions } from './utils/useSyncExternalStore' | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector) | ||
import { getBatch } from './utils/batch' | ||
@@ -10,1 +20,3 @@ | ||
export { batch } | ||
export * from './exports' |
import React from 'react' | ||
import { Action, AnyAction, Store } from 'redux' | ||
import type { Action, AnyAction, Store } from 'redux' | ||
import type { Subscription } from '../utils/Subscription' | ||
@@ -4,0 +4,0 @@ |
@@ -16,3 +16,3 @@ import { useContext } from 'react' | ||
* | ||
* export const CounterComponent = ({ value }) => { | ||
* export const CounterComponent = () => { | ||
* const { store } = useReduxContext() | ||
@@ -19,0 +19,0 @@ * return <div>{store.getState()}</div> |
import { useContext, useDebugValue } from 'react' | ||
// @ts-ignore | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector' | ||
import { useReduxContext as useDefaultReduxContext } from './useReduxContext' | ||
import { ReactReduxContext } from '../components/Context' | ||
import { DefaultRootState, EqualityFn } from '../types' | ||
import { getSyncFunctions } from '../utils/useSyncExternalStore' | ||
import type { DefaultRootState, EqualityFn } from '../types' | ||
const [, useSyncExternalStoreWithSelector] = getSyncFunctions() | ||
const refEquality: EqualityFn<any> = (a, b) => a === b | ||
@@ -11,0 +11,0 @@ |
@@ -1,6 +0,16 @@ | ||
export * from './exports' | ||
// The default entry point assumes we are working with React 18, and thus have | ||
// useSyncExternalStore available. We can import that directly from React itself. | ||
// The useSyncExternalStoreWithSelector has to be imported, but we can use the | ||
// non-shim version. This shaves off the byte size of the shim. | ||
// @ts-ignore React types not updated yet | ||
import { useSyncExternalStore } from 'react' | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector' | ||
import { setSyncFunctions } from './utils/useSyncExternalStore' | ||
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates' | ||
import { setBatch } from './utils/batch' | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector) | ||
// Enable batched updates in our subscriptions for use | ||
@@ -11,1 +21,3 @@ // with standard React renderers (ReactDOM, React Native) | ||
export { batch } | ||
export * from './exports' |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
306053
50
125
6515
11
20
+ Added@testing-library/react-12@npm:@testing-library/react@^12
+ Addedreact-17@npm:react@^17
+ Added@babel/code-frame@7.24.7(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/highlight@7.24.7(transitive)
+ Added@testing-library/dom@8.20.1(transitive)
+ Added@testing-library/react@12.1.5(transitive)
+ Added@types/aria-query@5.0.4(transitive)
+ Added@types/react@17.0.80(transitive)
+ Added@types/react-dom@17.0.25(transitive)
+ Added@types/scheduler@0.16.8(transitive)
+ Added@types/use-sync-external-store@0.0.3(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@3.2.14.3.05.2.0(transitive)
+ Addedaria-query@5.1.3(transitive)
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedchalk@2.4.24.1.2(transitive)
+ Addedcolor-convert@1.9.32.0.1(transitive)
+ Addedcolor-name@1.1.31.1.4(transitive)
+ Addeddeep-equal@2.2.3(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddom-accessibility-api@0.5.16(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-get-iterator@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-flag@3.0.04.0.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-arguments@1.1.1(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakset@2.0.3(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedlz-string@1.5.0(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedobject-is@1.1.6(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpicocolors@1.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedpretty-format@27.5.1(transitive)
+ Addedreact@17.0.218.0.0-beta-fdc1d617a-20211118(transitive)
+ Addedreact-dom@17.0.2(transitive)
+ Addedreact-is@17.0.218.3.1(transitive)
+ Addedreact-shallow-renderer@16.15.0(transitive)
+ Addedreact-test-renderer@17.0.2(transitive)
+ Addedregexp.prototype.flags@1.5.2(transitive)
+ Addedscheduler@0.20.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstop-iteration-iterator@1.0.0(transitive)
+ Addedsupports-color@5.5.07.2.0(transitive)
+ Addeduse-sync-external-store@1.0.0-beta-fdc1d617a-20211118(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
- Removedloose-envify@^1.4.0
- Removed@types/use-sync-external-store@0.0.0(transitive)
- Removedreact@18.0.0-alpha-5cccacd13-20211101(transitive)
- Removeduse-sync-external-store@1.0.0-alpha-5cccacd13-20211101(transitive)
Updateduse-sync-external-store@1.0.0-beta-fdc1d617a-20211118