react-error-boundary 4.0.13 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType, ErrorInfo, PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
declare function FallbackRender(props: FallbackProps): ReactNode;
|
|
3
3
|
export type FallbackProps = {
|
|
4
4
|
error: any;
|
|
@@ -27,7 +27,7 @@ export type ErrorBoundaryPropsWithRender = ErrorBoundarySharedProps & {
|
|
|
27
27
|
fallbackRender: typeof FallbackRender;
|
|
28
28
|
};
|
|
29
29
|
export type ErrorBoundaryPropsWithFallback = ErrorBoundarySharedProps & {
|
|
30
|
-
fallback:
|
|
30
|
+
fallback: ReactNode;
|
|
31
31
|
FallbackComponent?: never;
|
|
32
32
|
fallbackRender?: never;
|
|
33
33
|
};
|
|
@@ -87,7 +87,7 @@ class ErrorBoundary extends react.Component {
|
|
|
87
87
|
childToRender = fallbackRender(props);
|
|
88
88
|
} else if (FallbackComponent) {
|
|
89
89
|
childToRender = react.createElement(FallbackComponent, props);
|
|
90
|
-
} else if (fallback
|
|
90
|
+
} else if (fallback !== undefined) {
|
|
91
91
|
childToRender = fallback;
|
|
92
92
|
} else {
|
|
93
93
|
throw error;
|
|
@@ -87,7 +87,7 @@ class ErrorBoundary extends react.Component {
|
|
|
87
87
|
childToRender = fallbackRender(props);
|
|
88
88
|
} else if (FallbackComponent) {
|
|
89
89
|
childToRender = react.createElement(FallbackComponent, props);
|
|
90
|
-
} else if (fallback
|
|
90
|
+
} else if (fallback !== undefined) {
|
|
91
91
|
childToRender = fallback;
|
|
92
92
|
} else {
|
|
93
93
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { createContext, Component, createElement,
|
|
2
|
+
import { createContext, Component, createElement, useContext, useState, useMemo, forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
const ErrorBoundaryContext = createContext(null);
|
|
5
5
|
|
|
@@ -83,7 +83,7 @@ class ErrorBoundary extends Component {
|
|
|
83
83
|
childToRender = fallbackRender(props);
|
|
84
84
|
} else if (FallbackComponent) {
|
|
85
85
|
childToRender = createElement(FallbackComponent, props);
|
|
86
|
-
} else if (fallback
|
|
86
|
+
} else if (fallback !== undefined) {
|
|
87
87
|
childToRender = fallback;
|
|
88
88
|
} else {
|
|
89
89
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { createContext, Component, createElement,
|
|
2
|
+
import { createContext, Component, createElement, useContext, useState, useMemo, forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
const ErrorBoundaryContext = createContext(null);
|
|
5
5
|
|
|
@@ -83,7 +83,7 @@ class ErrorBoundary extends Component {
|
|
|
83
83
|
childToRender = fallbackRender(props);
|
|
84
84
|
} else if (FallbackComponent) {
|
|
85
85
|
childToRender = createElement(FallbackComponent, props);
|
|
86
|
-
} else if (fallback
|
|
86
|
+
} else if (fallback !== undefined) {
|
|
87
87
|
childToRender = fallback;
|
|
88
88
|
} else {
|
|
89
89
|
throw error;
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-error-boundary",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Simple reusable React error boundary component",
|
|
5
5
|
"author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"packageManager": "pnpm@8.6.10",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "https://github.com/bvaughn/react-error-boundary"
|
|
11
10
|
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=20",
|
|
13
|
+
"pnpm": "=9"
|
|
14
|
+
},
|
|
12
15
|
"main": "dist/react-error-boundary.cjs.js",
|
|
13
16
|
"module": "dist/react-error-boundary.esm.js",
|
|
14
17
|
"exports": {
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
],
|
|
41
44
|
"sideEffects": false,
|
|
42
45
|
"scripts": {
|
|
43
|
-
"clear": "
|
|
46
|
+
"clear": "pnpm clear:builds & pnpm clear:node_modules",
|
|
44
47
|
"clear:builds": "rm -rf ./dist",
|
|
45
48
|
"clear:node_modules": "rm -rf ./node_modules",
|
|
46
49
|
"prerelease": "preconstruct build",
|