react-redux
Advanced tools
Comparing version 8.0.0-beta.0 to 8.0.0-beta.1
@@ -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}));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} | ||
!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 h=v;const g=(e,t)=>e===t;function P(e=b){const r=e===b?S:()=>t.useContext(e);return function(e,n=g){const{store:o}=r(),u=h(o.subscribe,o.getState,o.getState,e,n);return t.useDebugValue(u),u}}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 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; | ||
*/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,he=60130,ge=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 $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})})); | ||
*/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"),he=Pe("react.offscreen"),ge=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===ge||e===he||"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();h=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}){const u=t.useMemo((()=>{const t=Fe(e);return{store:e,subscription:t}}),[e]),c=t.useMemo((()=>e.getState()),[e]);return ke((()=>{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||b).Provider,{value:u},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=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]),[y,m]=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]),v=t.useMemo((()=>i?a:w({},a,{subscription:y})),[i,a,y]),h=t.useRef(),g=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=b((()=>()=>P.current&&c===g.current?P.current:d(f.getState(),c)),[f,c]),E=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}}(S,f,y,d,g,h,$,O,P,m,e):()=>{}),[y]);var j,R,T;let q;j=He,R=[g,h,$,c,P,m],ke((()=>j(...R)),T);try{q=We(E,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,h.current=q}));const N=t.useMemo((()=>o.default.createElement(e,w({},q,{ref:u}))),[u,e,q]);return t.useMemo((()=>S?o.default.createElement(s.Provider,{value:v},N):N),[s,N,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,w({},e,{reactReduxForwardedRef:t}))}));return t.displayName=n,t.WrappedComponent=e,ue(t,e)}return ue(h,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})})); |
@@ -7,4 +7,6 @@ // The "alternate renderers" entry point is primarily here to fall back on a no-op | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector'; | ||
import { setSyncFunctions } from './utils/useSyncExternalStore'; | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector); | ||
import { initializeUseSelector } from './hooks/useSelector'; | ||
import { initializeConnect } from './components/connect'; | ||
initializeUseSelector(useSyncExternalStoreWithSelector); | ||
initializeConnect(useSyncExternalStore); | ||
import { getBatch } from './utils/batch'; // For other renderers besides ReactDOM and React Native, | ||
@@ -11,0 +13,0 @@ // use the default noop batch function |
@@ -6,6 +6,8 @@ // The "compat" entry point assumes we're working with standard ReactDOM/RN, but | ||
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/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 | ||
import { initializeUseSelector } from './hooks/useSelector'; | ||
import { initializeConnect } from './components/connect'; | ||
initializeUseSelector(useSyncExternalStoreWithSelector); | ||
initializeConnect(useSyncExternalStore); // Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
@@ -12,0 +14,0 @@ |
@@ -6,2 +6,4 @@ import React from 'react'; | ||
import { ReactReduxContext, ReactReduxContextInstance } from './Context'; | ||
import type { uSES } from '../utils/useSyncExternalStore'; | ||
export declare const initializeConnect: (fn: uSES) => void; | ||
export interface ConnectProps { | ||
@@ -8,0 +10,0 @@ reactReduxForwardedRef?: React.ForwardedRef<unknown>; |
@@ -15,6 +15,9 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'; | ||
import { getSyncFunctions } from '../utils/useSyncExternalStore'; | ||
import shallowEqual from '../utils/shallowEqual'; | ||
import { ReactReduxContext } from './Context'; | ||
const [useSyncExternalStore] = getSyncFunctions(); // Define some constant arrays just to avoid re-creating these | ||
import { notInitialized } from '../utils/useSyncExternalStore'; | ||
let useSyncExternalStore = notInitialized; | ||
export const initializeConnect = fn => { | ||
useSyncExternalStore = fn; | ||
}; // Define some constant arrays just to avoid re-creating these | ||
@@ -21,0 +24,0 @@ const EMPTY_ARRAY = [null, 0]; |
/// <reference types="react" /> | ||
import type { DefaultRootState, EqualityFn } from '../types'; | ||
import type { uSESWS } from '../utils/useSyncExternalStore'; | ||
export declare const initializeUseSelector: (fn: uSESWS) => void; | ||
/** | ||
@@ -4,0 +6,0 @@ * Hook factory, which creates a `useSelector` hook bound to a given context. |
import { useContext, useDebugValue } from 'react'; | ||
import { useReduxContext as useDefaultReduxContext } from './useReduxContext'; | ||
import { ReactReduxContext } from '../components/Context'; | ||
import { getSyncFunctions } from '../utils/useSyncExternalStore'; | ||
const [, useSyncExternalStoreWithSelector] = getSyncFunctions(); | ||
import { notInitialized } from '../utils/useSyncExternalStore'; | ||
let useSyncExternalStoreWithSelector = notInitialized; | ||
export const initializeUseSelector = fn => { | ||
useSyncExternalStoreWithSelector = fn; | ||
}; | ||
@@ -7,0 +10,0 @@ const refEquality = (a, b) => a === b; |
@@ -8,6 +8,8 @@ // The default entry point assumes we are working with React 18, and thus have | ||
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 | ||
import { initializeUseSelector } from './hooks/useSelector'; | ||
import { initializeConnect } from './components/connect'; | ||
initializeUseSelector(useSyncExternalStoreWithSelector); | ||
initializeConnect(useSyncExternalStore); // Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
@@ -14,0 +16,0 @@ |
import type { useSyncExternalStore } from 'use-sync-external-store'; | ||
import type { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'; | ||
export declare const setSyncFunctions: (sync: typeof useSyncExternalStore, withSelector: typeof useSyncExternalStoreWithSelector) => void; | ||
export declare const getSyncFunctions: () => readonly [typeof useSyncExternalStore, typeof useSyncExternalStoreWithSelector]; | ||
export declare const notInitialized: () => never; | ||
export declare type uSES = typeof useSyncExternalStore; | ||
export declare type uSESWS = typeof useSyncExternalStoreWithSelector; |
@@ -1,13 +0,3 @@ | ||
const notInitialized = () => { | ||
throw new Error('Not initialize!'); | ||
}; | ||
let uSES = notInitialized; | ||
let uSESWS = notInitialized; // Allow injecting the actual functions from the entry points | ||
export const setSyncFunctions = (sync, withSelector) => { | ||
uSES = sync; | ||
uSESWS = withSelector; | ||
}; // Supply a getter just to skip dealing with ESM bindings | ||
export const getSyncFunctions = () => [uSES, uSESWS]; | ||
export const notInitialized = () => { | ||
throw new Error('uSES not initialized!'); | ||
}; |
@@ -13,4 +13,6 @@ "use strict"; | ||
var _useSyncExternalStore = require("./utils/useSyncExternalStore"); | ||
var _useSelector = require("./hooks/useSelector"); | ||
var _connect = require("./components/connect"); | ||
var _batch = require("./utils/batch"); | ||
@@ -35,3 +37,4 @@ | ||
// Because of that, we'll also assume the useSyncExternalStore compat shim is needed. | ||
(0, _useSyncExternalStore.setSyncFunctions)(_shim.useSyncExternalStore, _withSelector.useSyncExternalStoreWithSelector); | ||
(0, _useSelector.initializeUseSelector)(_withSelector.useSyncExternalStoreWithSelector); | ||
(0, _connect.initializeConnect)(_shim.useSyncExternalStore); | ||
// For other renderers besides ReactDOM and React Native, | ||
@@ -38,0 +41,0 @@ // use the default noop batch function |
@@ -18,4 +18,2 @@ "use strict"; | ||
var _useSyncExternalStore = require("./utils/useSyncExternalStore"); | ||
var _reactBatchedUpdates = require("./utils/reactBatchedUpdates"); | ||
@@ -25,2 +23,6 @@ | ||
var _useSelector = require("./hooks/useSelector"); | ||
var _connect = require("./components/connect"); | ||
var _exports = require("./exports"); | ||
@@ -42,5 +44,6 @@ | ||
// Because of that, the useSyncExternalStore compat shim is needed. | ||
(0, _useSyncExternalStore.setSyncFunctions)(_shim.useSyncExternalStore, _withSelector.useSyncExternalStoreWithSelector); // Enable batched updates in our subscriptions for use | ||
(0, _useSelector.initializeUseSelector)(_withSelector.useSyncExternalStoreWithSelector); | ||
(0, _connect.initializeConnect)(_shim.useSyncExternalStore); // Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
(0, _batch.setBatch)(_reactBatchedUpdates.unstable_batchedUpdates); |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
exports.default = exports.initializeConnect = void 0; | ||
@@ -31,4 +31,2 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _useSyncExternalStore = require("../utils/useSyncExternalStore"); | ||
var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual")); | ||
@@ -38,2 +36,4 @@ | ||
var _useSyncExternalStore = require("../utils/useSyncExternalStore"); | ||
const _excluded = ["reactReduxForwardedRef"]; | ||
@@ -45,4 +45,10 @@ | ||
const [useSyncExternalStore] = (0, _useSyncExternalStore.getSyncFunctions)(); // Define some constant arrays just to avoid re-creating these | ||
let useSyncExternalStore = _useSyncExternalStore.notInitialized; | ||
const initializeConnect = fn => { | ||
useSyncExternalStore = fn; | ||
}; // Define some constant arrays just to avoid re-creating these | ||
exports.initializeConnect = initializeConnect; | ||
const EMPTY_ARRAY = [null, 0]; | ||
@@ -49,0 +55,0 @@ const NO_SUBSCRIPTION_ARRAY = [null, null]; // Attempts to stringify whatever not-really-a-component value we were given |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.createSelectorHook = createSelectorHook; | ||
exports.useSelector = void 0; | ||
exports.useSelector = exports.initializeUseSelector = void 0; | ||
@@ -16,4 +16,10 @@ var _react = require("react"); | ||
const [, useSyncExternalStoreWithSelector] = (0, _useSyncExternalStore.getSyncFunctions)(); | ||
let useSyncExternalStoreWithSelector = _useSyncExternalStore.notInitialized; | ||
const initializeUseSelector = fn => { | ||
useSyncExternalStoreWithSelector = fn; | ||
}; | ||
exports.initializeUseSelector = initializeUseSelector; | ||
const refEquality = (a, b) => a === b; | ||
@@ -20,0 +26,0 @@ /** |
@@ -18,4 +18,2 @@ "use strict"; | ||
var _useSyncExternalStore = require("./utils/useSyncExternalStore"); | ||
var _reactBatchedUpdates = require("./utils/reactBatchedUpdates"); | ||
@@ -25,2 +23,6 @@ | ||
var _useSelector = require("./hooks/useSelector"); | ||
var _connect = require("./components/connect"); | ||
var _exports = require("./exports"); | ||
@@ -44,5 +46,6 @@ | ||
// @ts-ignore React types not updated yet | ||
(0, _useSyncExternalStore.setSyncFunctions)(_react.useSyncExternalStore, _withSelector.useSyncExternalStoreWithSelector); // Enable batched updates in our subscriptions for use | ||
(0, _useSelector.initializeUseSelector)(_withSelector.useSyncExternalStoreWithSelector); | ||
(0, _connect.initializeConnect)(_react.useSyncExternalStore); // Enable batched updates in our subscriptions for use | ||
// with standard React renderers (ReactDOM, React Native) | ||
(0, _batch.setBatch)(_reactBatchedUpdates.unstable_batchedUpdates); |
"use strict"; | ||
exports.__esModule = true; | ||
exports.getSyncFunctions = exports.setSyncFunctions = void 0; | ||
exports.notInitialized = void 0; | ||
const notInitialized = () => { | ||
throw new Error('Not initialize!'); | ||
throw new Error('uSES not initialized!'); | ||
}; | ||
let uSES = notInitialized; | ||
let uSESWS = notInitialized; // Allow injecting the actual functions from the entry points | ||
const setSyncFunctions = (sync, withSelector) => { | ||
uSES = sync; | ||
uSESWS = withSelector; | ||
}; // Supply a getter just to skip dealing with ESM bindings | ||
exports.setSyncFunctions = setSyncFunctions; | ||
const getSyncFunctions = () => [uSES, uSESWS]; | ||
exports.getSyncFunctions = getSyncFunctions; | ||
exports.notInitialized = notInitialized; |
{ | ||
"name": "react-redux", | ||
"version": "8.0.0-beta.0", | ||
"version": "8.0.0-beta.1", | ||
"description": "Official React bindings for Redux", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -9,5 +9,7 @@ // The "alternate renderers" entry point is primarily here to fall back on a no-op | ||
import { setSyncFunctions } from './utils/useSyncExternalStore' | ||
import { initializeUseSelector } from './hooks/useSelector' | ||
import { initializeConnect } from './components/connect' | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector) | ||
initializeUseSelector(useSyncExternalStoreWithSelector) | ||
initializeConnect(useSyncExternalStore) | ||
@@ -14,0 +16,0 @@ import { getBatch } from './utils/batch' |
@@ -8,8 +8,11 @@ // The "compat" entry point assumes we're working with standard ReactDOM/RN, but | ||
import { setSyncFunctions } from './utils/useSyncExternalStore' | ||
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates' | ||
import { setBatch } from './utils/batch' | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector) | ||
import { initializeUseSelector } from './hooks/useSelector' | ||
import { initializeConnect } from './components/connect' | ||
initializeUseSelector(useSyncExternalStoreWithSelector) | ||
initializeConnect(useSyncExternalStore) | ||
// Enable batched updates in our subscriptions for use | ||
@@ -16,0 +19,0 @@ // with standard React renderers (ReactDOM, React Native) |
@@ -5,6 +5,10 @@ import { useContext, useDebugValue } from 'react' | ||
import { ReactReduxContext } from '../components/Context' | ||
import { getSyncFunctions } from '../utils/useSyncExternalStore' | ||
import type { DefaultRootState, EqualityFn } from '../types' | ||
import type { uSESWS } from '../utils/useSyncExternalStore' | ||
import { notInitialized } from '../utils/useSyncExternalStore' | ||
const [, useSyncExternalStoreWithSelector] = getSyncFunctions() | ||
let useSyncExternalStoreWithSelector = notInitialized as uSESWS | ||
export const initializeUseSelector = (fn: uSESWS) => { | ||
useSyncExternalStoreWithSelector = fn | ||
} | ||
@@ -11,0 +15,0 @@ const refEquality: EqualityFn<any> = (a, b) => a === b |
@@ -10,8 +10,11 @@ // The default entry point assumes we are working with React 18, and thus have | ||
import { setSyncFunctions } from './utils/useSyncExternalStore' | ||
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates' | ||
import { setBatch } from './utils/batch' | ||
setSyncFunctions(useSyncExternalStore, useSyncExternalStoreWithSelector) | ||
import { initializeUseSelector } from './hooks/useSelector' | ||
import { initializeConnect } from './components/connect' | ||
initializeUseSelector(useSyncExternalStoreWithSelector) | ||
initializeConnect(useSyncExternalStore) | ||
// Enable batched updates in our subscriptions for use | ||
@@ -18,0 +21,0 @@ // with standard React renderers (ReactDOM, React Native) |
import type { useSyncExternalStore } from 'use-sync-external-store' | ||
import type { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector' | ||
const notInitialized = () => { | ||
throw new Error('Not initialize!') | ||
export const notInitialized = () => { | ||
throw new Error('uSES not initialized!') | ||
} | ||
let uSES: typeof useSyncExternalStore = notInitialized | ||
let uSESWS: typeof useSyncExternalStoreWithSelector = notInitialized | ||
// Allow injecting the actual functions from the entry points | ||
export const setSyncFunctions = ( | ||
sync: typeof useSyncExternalStore, | ||
withSelector: typeof useSyncExternalStoreWithSelector | ||
) => { | ||
uSES = sync | ||
uSESWS = withSelector | ||
} | ||
// Supply a getter just to skip dealing with ESM bindings | ||
export const getSyncFunctions = () => [uSES, uSESWS] as const | ||
export type uSES = typeof useSyncExternalStore | ||
export type uSESWS = typeof useSyncExternalStoreWithSelector |
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
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
306324
6536
19