Socket
Socket
Sign inDemoInstall

use-sync-external-store

Package Overview
Dependencies
1
Maintainers
1
Versions
1243
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-5b57bc6e3-20210921 to 0.0.0-experimental-5fa4d79b0-20211008

2

cjs/use-sync-external-store-extra.development.js

@@ -99,3 +99,2 @@ /** @license React vundefined

// The snapshot has changed, so we need to compute a new selection.
memoizedSnapshot = nextSnapshot;
var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data

@@ -114,2 +113,3 @@ // has changed. If it hasn't, return the previous selection. That signals

memoizedSnapshot = nextSnapshot;
memoizedSelection = nextSelection;

@@ -116,0 +116,0 @@ return nextSelection;

@@ -9,4 +9,4 @@ /** @license React vundefined

*/
'use strict';var h=require("react"),p=require("use-sync-external-store");function q(a,e){return a===e&&(0!==a||1/a===1/e)||a!==a&&e!==e}var r="function"===typeof Object.is?Object.is:q,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
exports.useSyncExternalStoreExtra=function(a,e,l,m,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(b){if(!c){c=!0;d=b;var a=m(b);return void 0!==g&&f.hasValue&&(b=f.value,g(b,a))?k=b:k=a}a=k;if(r(d,b))return a;d=b;b=m(b);return void 0!==g&&g(a,b)?a:k=b}var c=!1,d,k,n=void 0===l?null:l;return[function(){return a(e())},null===n?void 0:function(){return a(n())}]},[e,l,m,g]);var d=p.useSyncExternalStore(a,c[0],c[1]);u(function(){f.hasValue=
!0;f.value=d},[d]);w(d);return d};
'use strict';var h=require("react"),n=require("use-sync-external-store");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=h.useRef,t=h.useEffect,u=h.useMemo,v=h.useDebugValue;
exports.useSyncExternalStoreExtra=function(a,b,e,l,g){var c=r(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=u(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=n.useSyncExternalStore(a,
c[0],c[1]);t(function(){f.hasValue=!0;f.value=d},[d]);v(d);return d};

@@ -44,6 +44,7 @@ /** @license React vundefined

args = args.concat([stack]);
}
} // eslint-disable-next-line react-internal/safe-string-coercion
var argsWithFormat = args.map(function (item) {
return '' + item;
return String(item);
}); // Careful: RN currently depends on this prefix

@@ -75,8 +76,3 @@

useLayoutEffect = React.useLayoutEffect,
useDebugValue = React.useDebugValue,
builtInAPI = React.unstable_useSyncExternalStore; // Prefer the built-in API, if it exists. If it doesn't exist, then we assume
// we're in version 16 or 17, so rendering is always synchronous. The shim
// does not support concurrent rendering, only the built-in API.
var useSyncExternalStore = builtInAPI !== undefined ? builtInAPI : useSyncExternalStore_client;
useDebugValue = React.useDebugValue;
var didWarnOld18Alpha = false;

@@ -94,3 +90,3 @@ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works

function useSyncExternalStore_client(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18
function useSyncExternalStore(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18
// versions of React do not expose a way to check if we're hydrating. So

@@ -211,14 +207,7 @@ // users of the shim will need to track that themselves and return the

function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
if (getServerSnapshot === undefined) {
{
{
throw Error( "Missing getServerSnapshot, which is required for server-rendered content." );
}
}
}
return getServerSnapshot();
return getSnapshot();
}
var useSyncExternalStore$2 = canUseDOM ? useSyncExternalStore : useSyncExternalStore$1;
var builtInAPI = React.unstable_useSyncExternalStore;
var useSyncExternalStore$2 = builtInAPI !== undefined ? builtInAPI : canUseDOM ? useSyncExternalStore : useSyncExternalStore$1;

@@ -225,0 +214,0 @@ exports.useSyncExternalStore = useSyncExternalStore$2;

@@ -42,6 +42,7 @@ /** @license React vundefined

args = args.concat([stack]);
}
} // eslint-disable-next-line react-internal/safe-string-coercion
var argsWithFormat = args.map(function (item) {
return '' + item;
return String(item);
}); // Careful: RN currently depends on this prefix

@@ -73,8 +74,3 @@

useLayoutEffect = React.useLayoutEffect,
useDebugValue = React.useDebugValue,
builtInAPI = React.unstable_useSyncExternalStore; // Prefer the built-in API, if it exists. If it doesn't exist, then we assume
// we're in version 16 or 17, so rendering is always synchronous. The shim
// does not support concurrent rendering, only the built-in API.
var useSyncExternalStore = builtInAPI !== undefined ? builtInAPI : useSyncExternalStore_client;
useDebugValue = React.useDebugValue;
var didWarnOld18Alpha = false;

@@ -92,3 +88,3 @@ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works

function useSyncExternalStore_client(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18
function useSyncExternalStore(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18
// versions of React do not expose a way to check if we're hydrating. So

@@ -95,0 +91,0 @@ // users of the shim will need to track that themselves and return the

@@ -9,3 +9,3 @@ /** @license React vundefined

*/
'use strict';var e=require("react");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue,q=e.unstable_useSyncExternalStore;function r(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;t(c)&&g({inst:c})},[a,d,b]);m(function(){t(c)&&g({inst:c});return a(function(){t(c)&&g({inst:c})})},[a]);p(d);return d}
function t(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}exports.useSyncExternalStore=void 0!==q?q:r;
'use strict';var e=require("react");function f(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:f,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(g){return!0}}
exports.useSyncExternalStore=function(a,b){var d=b(),g=l({inst:{value:d,getSnapshot:b}}),c=g[0].inst,h=g[1];n(function(){c.value=d;c.getSnapshot=b;q(c)&&h({inst:c})},[a,d,b]);m(function(){q(c)&&h({inst:c});return a(function(){q(c)&&h({inst:c})})},[a]);p(d);return d};

@@ -9,5 +9,3 @@ /** @license React vundefined

*/
'use strict';var e=require("react");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue,q=e.unstable_useSyncExternalStore,t=void 0!==q?q:r;
function r(a,b){var c=b(),f=l({inst:{value:c,getSnapshot:b}}),d=f[0].inst,g=f[1];n(function(){d.value=c;d.getSnapshot=b;u(d)&&g({inst:d})},[a,c,b]);m(function(){u(d)&&g({inst:d});return a(function(){u(d)&&g({inst:d})})},[a]);p(c);return c}function u(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!k(a,c)}catch(f){return!0}}
function v(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function w(a,b,c){if(void 0===c)throw Error(v(408));return c()}
exports.useSyncExternalStore="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?t:w;
'use strict';var e=require("react"),h=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement);function k(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var l="function"===typeof Object.is?Object.is:k,m=e.useState,n=e.useEffect,p=e.useLayoutEffect,q=e.useDebugValue;
function r(a,b){var d=b(),f=m({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];p(function(){c.value=d;c.getSnapshot=b;t(c)&&g({inst:c})},[a,d,b]);n(function(){t(c)&&g({inst:c});return a(function(){t(c)&&g({inst:c})})},[a]);q(d);return d}function t(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!l(a,d)}catch(f){return!0}}function u(a,b){return b()}var v=e.unstable_useSyncExternalStore;exports.useSyncExternalStore=void 0!==v?v:h?r:u;
{
"name": "use-sync-external-store",
"description": "Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.",
"version": "0.0.0-experimental-5b57bc6e3-20210921",
"version": "0.0.0-experimental-5fa4d79b0-20211008",
"repository": {

@@ -21,4 +21,4 @@ "type": "git",

"peerDependencies": {
"react": "0.0.0-experimental-5b57bc6e3-20210921"
"react": "0.0.0-experimental-5fa4d79b0-20211008"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc