@wixc3/react-board
Advanced tools
Comparing version 2.0.5 to 2.1.2
@@ -10,10 +10,15 @@ "use strict"; | ||
const client_1 = __importDefault(require("react-dom/client")); | ||
const reactRootByContainer = new WeakMap(); | ||
const reactErrorHandledRendering = async (element, container) => { | ||
if (client_1.default.createRoot) { | ||
// react 18+ | ||
const reactRoot = client_1.default.createRoot(container); | ||
const reactRoot = reactRootByContainer.get(container) || client_1.default.createRoot(container); | ||
reactRootByContainer.set(container, reactRoot); | ||
await new Promise((resolve, reject) => { | ||
reactRoot.render(react_1.default.createElement(ErrorBoundary, { onMount: resolve, reportError: reject }, element)); | ||
reactRoot === null || reactRoot === void 0 ? void 0 : reactRoot.render(react_1.default.createElement(ErrorBoundary, { onRender: resolve, reportError: reject }, element)); | ||
}); | ||
return () => reactRoot.unmount(); | ||
return () => { | ||
reactRoot === null || reactRoot === void 0 ? void 0 : reactRoot.unmount(); | ||
reactRootByContainer.delete(container); | ||
}; | ||
} | ||
@@ -43,4 +48,8 @@ else { | ||
var _a, _b; | ||
(_b = (_a = this.props).onMount) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
(_b = (_a = this.props).onRender) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
} | ||
componentDidUpdate() { | ||
var _a, _b; | ||
(_b = (_a = this.props).onRender) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
} | ||
render() { | ||
@@ -47,0 +56,0 @@ return this.state.hasError ? null : this.props.children; |
{ | ||
"name": "@wixc3/react-board", | ||
"description": "Library for creation of React component boards", | ||
"version": "2.0.5", | ||
"version": "2.1.2", | ||
"main": "dist/index.js", | ||
@@ -11,3 +11,3 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@wixc3/board-core": "^2.0.5" | ||
"@wixc3/board-core": "^2.1.2" | ||
}, | ||
@@ -14,0 +14,0 @@ "files": [ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16936
232
0
Updated@wixc3/board-core@^2.1.2