react-freeze
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -7,3 +7,3 @@ import React from "react"; | ||
} | ||
export declare function Freeze({ freeze, children, placeholder }: Props): JSX.Element; | ||
export declare function Freeze({ freeze, children, placeholder }: Props): React.JSX.Element; | ||
export {}; |
@@ -6,27 +6,18 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var infiniteThenable = { | ||
then: function then() {} | ||
}; | ||
function Suspender(_ref) { | ||
var freeze = _ref.freeze, | ||
children = _ref.children; | ||
var promiseCache = React.useRef({}).current; | ||
if (freeze && !promiseCache.promise) { | ||
promiseCache.promise = new Promise(function (resolve) { | ||
promiseCache.resolve = resolve; | ||
}); | ||
throw promiseCache.promise; | ||
} else if (freeze) { | ||
throw promiseCache.promise; | ||
} else if (promiseCache.promise) { | ||
promiseCache.resolve(); | ||
promiseCache.promise = undefined; | ||
children = _ref.children; | ||
if (freeze) { | ||
throw infiniteThenable; | ||
} | ||
return React__default.createElement(React.Fragment, null, children); | ||
} | ||
function Freeze(_ref2) { | ||
var freeze = _ref2.freeze, | ||
children = _ref2.children, | ||
_ref2$placeholder = _ref2.placeholder, | ||
placeholder = _ref2$placeholder === void 0 ? null : _ref2$placeholder; | ||
children = _ref2.children, | ||
_ref2$placeholder = _ref2.placeholder, | ||
placeholder = _ref2$placeholder === void 0 ? null : _ref2$placeholder; | ||
return React__default.createElement(React.Suspense, { | ||
@@ -33,0 +24,0 @@ fallback: placeholder |
@@ -1,28 +0,19 @@ | ||
import React, { Suspense, useRef, Fragment } from 'react'; | ||
import React, { Suspense, Fragment } from 'react'; | ||
var infiniteThenable = { | ||
then: function then() {} | ||
}; | ||
function Suspender(_ref) { | ||
var freeze = _ref.freeze, | ||
children = _ref.children; | ||
var promiseCache = useRef({}).current; | ||
if (freeze && !promiseCache.promise) { | ||
promiseCache.promise = new Promise(function (resolve) { | ||
promiseCache.resolve = resolve; | ||
}); | ||
throw promiseCache.promise; | ||
} else if (freeze) { | ||
throw promiseCache.promise; | ||
} else if (promiseCache.promise) { | ||
promiseCache.resolve(); | ||
promiseCache.promise = undefined; | ||
children = _ref.children; | ||
if (freeze) { | ||
throw infiniteThenable; | ||
} | ||
return React.createElement(Fragment, null, children); | ||
} | ||
function Freeze(_ref2) { | ||
var freeze = _ref2.freeze, | ||
children = _ref2.children, | ||
_ref2$placeholder = _ref2.placeholder, | ||
placeholder = _ref2$placeholder === void 0 ? null : _ref2$placeholder; | ||
children = _ref2.children, | ||
_ref2$placeholder = _ref2.placeholder, | ||
placeholder = _ref2$placeholder === void 0 ? null : _ref2$placeholder; | ||
return React.createElement(Suspense, { | ||
@@ -29,0 +20,0 @@ fallback: placeholder |
{ | ||
"name": "react-freeze", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "React Freeze", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
17179
86