Socket
Socket
Sign inDemoInstall

react-error-boundary

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-error-boundary - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

1

dist/index.d.ts

@@ -47,2 +47,3 @@ import * as React from 'react';

componentDidCatch(error: Error, info: React.ErrorInfo): void;
componentDidMount(): void;
componentDidUpdate(prevProps: ErrorBoundaryProps): void;

@@ -49,0 +50,0 @@ render(): {} | null | undefined;

2

dist/react-error-boundary.cjs.d.ts

@@ -1,1 +0,1 @@

export * from ".";
export * from "../dist/index";

@@ -12,3 +12,3 @@ 'use strict';

var changedArray = function (a, b) {
var changedArray = function changedArray(a, b) {
if (a === void 0) {

@@ -79,2 +79,10 @@ a = [];

_proto.componentDidMount = function componentDidMount() {
var error = this.state.error;
if (error !== null) {
this.updatedWithError = true;
}
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {

@@ -103,3 +111,3 @@ var error = this.state.error;

_proto.render = function render() {
var error = this.state.error; // @ts-expect-error ts(2339) (at least one of these will be defined though, and we check for their existance)
var error = this.state.error; // @ts-expect-error ts(2339) (at least one of these will be defined though, and we check for their existence)

@@ -135,3 +143,3 @@ var _this$props4 = this.props,

function withErrorBoundary(Component, errorBoundaryProps) {
var Wrapped = function (props) {
var Wrapped = function Wrapped(props) {
return /*#__PURE__*/React.createElement(ErrorBoundary, errorBoundaryProps, /*#__PURE__*/React.createElement(Component, props));

@@ -138,0 +146,0 @@ }; // Format for display in DevTools

@@ -1,1 +0,1 @@

export * from ".";
export * from "../dist/index";
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
import { isValidElement, createElement, Component, useState } from 'react';
var changedArray = function (a, b) {
var changedArray = function changedArray(a, b) {
if (a === void 0) {

@@ -70,2 +70,10 @@ a = [];

_proto.componentDidMount = function componentDidMount() {
var error = this.state.error;
if (error !== null) {
this.updatedWithError = true;
}
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {

@@ -94,3 +102,3 @@ var error = this.state.error;

_proto.render = function render() {
var error = this.state.error; // @ts-expect-error ts(2339) (at least one of these will be defined though, and we check for their existance)
var error = this.state.error; // @ts-expect-error ts(2339) (at least one of these will be defined though, and we check for their existence)

@@ -126,3 +134,3 @@ var _this$props4 = this.props,

function withErrorBoundary(Component, errorBoundaryProps) {
var Wrapped = function (props) {
var Wrapped = function Wrapped(props) {
return /*#__PURE__*/createElement(ErrorBoundary, errorBoundaryProps, /*#__PURE__*/createElement(Component, props));

@@ -129,0 +137,0 @@ }; // Format for display in DevTools

@@ -1,1 +0,1 @@

export * from ".";
export * from "../dist/index";

@@ -7,9 +7,18 @@ (function (global, factory) {

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
_setPrototypeOf(subClass, superClass);
}
var changedArray = function (a, b) {
var changedArray = function changedArray(a, b) {
if (a === void 0) {

@@ -80,2 +89,10 @@ a = [];

_proto.componentDidMount = function componentDidMount() {
var error = this.state.error;
if (error !== null) {
this.updatedWithError = true;
}
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {

@@ -104,3 +121,3 @@ var error = this.state.error;

_proto.render = function render() {
var error = this.state.error; // @ts-expect-error ts(2339) (at least one of these will be defined though, and we check for their existance)
var error = this.state.error; // @ts-expect-error ts(2339) (at least one of these will be defined though, and we check for their existence)

@@ -136,3 +153,3 @@ var _this$props4 = this.props,

function withErrorBoundary(Component, errorBoundaryProps) {
var Wrapped = function (props) {
var Wrapped = function Wrapped(props) {
return /*#__PURE__*/React.createElement(ErrorBoundary, errorBoundaryProps, /*#__PURE__*/React.createElement(Component, props));

@@ -139,0 +156,0 @@ }; // Format for display in DevTools

@@ -1,1 +0,1 @@

export * from ".";
export * from "../dist/index";

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

!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).ReactErrorBoundary={},r.React)}(this,(function(r,e){"use strict";var t={error:null},o=function(r){var o,n;function a(){for(var e,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return(e=r.call.apply(r,[this].concat(n))||this).state=t,e.updatedWithError=!1,e.resetErrorBoundary=function(){for(var r,t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];null==e.props.onReset||(r=e.props).onReset.apply(r,o),e.reset()},e}n=r,(o=a).prototype=Object.create(n.prototype),o.prototype.constructor=o,o.__proto__=n,a.getDerivedStateFromError=function(r){return{error:r}};var i=a.prototype;return i.reset=function(){this.updatedWithError=!1,this.setState(t)},i.componentDidCatch=function(r,e){var t,o;null==(t=(o=this.props).onError)||t.call(o,r,e)},i.componentDidUpdate=function(r){var e,t,o,n,a=this.state.error,i=this.props.resetKeys;null===a||this.updatedWithError?null!==a&&(void 0===(o=r.resetKeys)&&(o=[]),void 0===(n=i)&&(n=[]),o.length!==n.length||o.some((function(r,e){return!Object.is(r,n[e])})))&&(null==(e=(t=this.props).onResetKeysChange)||e.call(t,r.resetKeys,i),this.reset()):this.updatedWithError=!0},i.render=function(){var r=this.state.error,t=this.props,o=t.fallbackRender,n=t.FallbackComponent,a=t.fallback;if(null!==r){var i={error:r,resetErrorBoundary:this.resetErrorBoundary};if(e.isValidElement(a))return a;if("function"==typeof o)return o(i);if(n)return e.createElement(n,i);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},a}(e.Component);r.ErrorBoundary=o,r.useErrorHandler=function(r){var t=e.useState(null),o=t[0],n=t[1];if(r)throw r;if(o)throw o;return n},r.withErrorBoundary=function(r,t){var n=function(n){return e.createElement(o,t,e.createElement(r,n))},a=r.displayName||r.name||"Unknown";return n.displayName="withErrorBoundary("+a+")",n},Object.defineProperty(r,"__esModule",{value:!0})}));
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).ReactErrorBoundary={},r.React)}(this,(function(r,e){"use strict";function t(r,e){return(t=Object.setPrototypeOf||function(r,e){return r.__proto__=e,r})(r,e)}var n={error:null},o=function(r){var o,a;function i(){for(var e,t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];return(e=r.call.apply(r,[this].concat(o))||this).state=n,e.updatedWithError=!1,e.resetErrorBoundary=function(){for(var r,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];null==e.props.onReset||(r=e.props).onReset.apply(r,n),e.reset()},e}a=r,(o=i).prototype=Object.create(a.prototype),o.prototype.constructor=o,t(o,a),i.getDerivedStateFromError=function(r){return{error:r}};var u=i.prototype;return u.reset=function(){this.updatedWithError=!1,this.setState(n)},u.componentDidCatch=function(r,e){var t,n;null==(t=(n=this.props).onError)||t.call(n,r,e)},u.componentDidMount=function(){null!==this.state.error&&(this.updatedWithError=!0)},u.componentDidUpdate=function(r){var e,t,n,o,a=this.state.error,i=this.props.resetKeys;null===a||this.updatedWithError?null!==a&&(void 0===(n=r.resetKeys)&&(n=[]),void 0===(o=i)&&(o=[]),n.length!==o.length||n.some((function(r,e){return!Object.is(r,o[e])})))&&(null==(e=(t=this.props).onResetKeysChange)||e.call(t,r.resetKeys,i),this.reset()):this.updatedWithError=!0},u.render=function(){var r=this.state.error,t=this.props,n=t.fallbackRender,o=t.FallbackComponent,a=t.fallback;if(null!==r){var i={error:r,resetErrorBoundary:this.resetErrorBoundary};if(e.isValidElement(a))return a;if("function"==typeof n)return n(i);if(o)return e.createElement(o,i);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},i}(e.Component);r.ErrorBoundary=o,r.useErrorHandler=function(r){var t=e.useState(null),n=t[0],o=t[1];if(r)throw r;if(n)throw n;return o},r.withErrorBoundary=function(r,t){var n=function(n){return e.createElement(o,t,e.createElement(r,n))},a=r.displayName||r.name||"Unknown";return n.displayName="withErrorBoundary("+a+")",n},Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=react-error-boundary.umd.min.js.map
{
"name": "react-error-boundary",
"version": "3.1.0",
"version": "3.1.1",
"description": "Simple reusable React error boundary component",

@@ -5,0 +5,0 @@ "main": "dist/react-error-boundary.cjs.js",

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