@legendapp/tools
Advanced tools
Comparing version 2.0.0-alpha.9 to 2.0.0-alpha.10
@@ -6,3 +6,3 @@ { | ||
"private": false, | ||
"version": "2.0.0-alpha.9", | ||
"version": "2.0.0-alpha.10", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "main": "./index.js", |
@@ -1,2 +0,2 @@ | ||
import { ComponentType } from 'react'; | ||
import { ComponentType, FC } from 'react'; | ||
declare type TypeOnError = (error: Error, info: ErrorInfo) => boolean | void; | ||
@@ -8,2 +8,5 @@ export interface ErrorInfo { | ||
onError?: TypeOnError; | ||
ErrorBoundary?: FC<{ | ||
onError?: TypeOnError; | ||
}>; | ||
} | ||
@@ -10,0 +13,0 @@ export declare function configureMemoFnComponent(config: Config): void; |
@@ -33,3 +33,3 @@ "use strict"; | ||
exports.configureMemoFnComponent = configureMemoFnComponent; | ||
class ErrorBoundary extends react_1.Component { | ||
class DefaultErrorBoundary extends react_1.Component { | ||
constructor(props) { | ||
@@ -72,3 +72,4 @@ super(props); | ||
if (onError) { | ||
out = (props) => (react_1.default.createElement(ErrorBoundary, null, (0, react_1.createElement)(Component, Object.assign({ onError }, props)))); | ||
const ErrorBoundary = _config.ErrorBoundary || DefaultErrorBoundary; | ||
out = (props) => react_1.default.createElement(ErrorBoundary, { onError: onError }, (0, react_1.createElement)(Component, props)); | ||
} | ||
@@ -80,4 +81,6 @@ return (0, react_1.memo)(out); | ||
let out = Component; | ||
if (onError || _config.onError) { | ||
const Wrapped = (props, ref) => (react_1.default.createElement(ErrorBoundary, null, (0, react_1.createElement)(Component, Object.assign({ onError, ref }, props)))); | ||
onError = onError || _config.onError; | ||
if (onError) { | ||
const ErrorBoundary = _config.ErrorBoundary || DefaultErrorBoundary; | ||
const Wrapped = (props, ref) => (react_1.default.createElement(ErrorBoundary, { onError: onError }, (0, react_1.createElement)(Component, Object.assign({ ref }, props)))); | ||
out = (0, react_1.forwardRef)(Wrapped); | ||
@@ -84,0 +87,0 @@ } |
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
36343
545