Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wixc3/react-board

Package Overview
Dependencies
Maintainers
86
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/react-board - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

6

dist/create-board.js

@@ -8,3 +8,2 @@ "use strict";

const react_1 = __importDefault(require("react"));
const react_dom_1 = __importDefault(require("react-dom"));
const board_core_1 = require("@wixc3/board-core");

@@ -24,7 +23,4 @@ const react_error_handled_render_1 = require("./react-error-handled-render");

}
await (0, react_error_handled_render_1.reactErrorHandledRendering)(element, target);
return (0, react_error_handled_render_1.reactErrorHandledRendering)(element, target);
}, target);
},
cleanup(target) {
react_dom_1.default.unmountComponentAtNode(target);
} }));

@@ -31,0 +27,0 @@ return res;

3

dist/react-error-handled-render.d.ts

@@ -1,2 +0,3 @@

export declare const reactErrorHandledRendering: (element: JSX.Element, container: HTMLElement) => Promise<void>;
import React from 'react';
export declare const reactErrorHandledRendering: (element: React.ReactElement, container: HTMLElement) => Promise<() => void>;
//# sourceMappingURL=react-error-handled-render.d.ts.map

@@ -9,5 +9,12 @@ "use strict";

const react_dom_1 = __importDefault(require("react-dom"));
const reactErrorHandledRendering = (element, container) => new Promise((resolve, reject) => {
react_dom_1.default.render(react_1.default.createElement(ErrorBoundary, { reportError: reject }, element), container, resolve);
});
const client_1 = __importDefault(require("react-dom/client"));
const reactErrorHandledRendering = async (element, container) => {
const reactRoot = client_1.default.createRoot
? client_1.default.createRoot(container)
: createReactLegacyRoot(container);
await new Promise((resolve, reject) => {
reactRoot.render(react_1.default.createElement(ErrorBoundary, { onMount: resolve, reportError: reject }, element));
});
return () => reactRoot.unmount();
};
exports.reactErrorHandledRendering = reactErrorHandledRendering;

@@ -26,9 +33,21 @@ class ErrorBoundary extends react_1.default.Component {

}
componentDidMount() {
var _a, _b;
(_b = (_a = this.props).onMount) === null || _b === void 0 ? void 0 : _b.call(_a);
}
render() {
if (this.state.hasError) {
return null;
}
return this.props.children;
return this.state.hasError ? null : this.props.children;
}
}
// react-dom@<=17 didn't have createRoot, so we polyfill one that uses previous APIs
function createReactLegacyRoot(container) {
return {
render(children) {
react_dom_1.default.render(children, container);
},
unmount() {
react_dom_1.default.unmountComponentAtNode(container);
},
};
}
//# sourceMappingURL=react-error-handled-render.js.map
{
"name": "@wixc3/react-board",
"description": "Library for creation of React component boards",
"version": "1.3.0",
"version": "2.0.0",
"main": "dist/index.js",

@@ -11,3 +11,3 @@ "peerDependencies": {

"dependencies": {
"@wixc3/board-core": "^1.2.0"
"@wixc3/board-core": "^2.0.0"
},

@@ -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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc