From dcdbb2d6c7c0b72197f04153d7c3e73e9e71ea5c Mon Sep 17 00:00:00 2001 From: AAGaming Date: Thu, 27 Jun 2024 00:06:00 -0400 Subject: [PATCH] feat(components): add ErrorBoundary --- package.json | 4 ++++ src/components/ErrorBoundary.ts | 6 ++++++ src/components/index.ts | 1 + 3 files changed, 11 insertions(+) create mode 100644 src/components/ErrorBoundary.ts diff --git a/package.json b/package.json index 99ef346..f2f5140 100644 --- a/package.json +++ b/package.json @@ -85,5 +85,9 @@ "style": "module", "parser": "typescript" } + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "tag": "latest" } } diff --git a/src/components/ErrorBoundary.ts b/src/components/ErrorBoundary.ts new file mode 100644 index 0000000..09ce307 --- /dev/null +++ b/src/components/ErrorBoundary.ts @@ -0,0 +1,6 @@ +import { Component, PropsWithChildren } from "react"; +import { findModuleExport } from "../webpack"; + +export const ErrorBoundary = findModuleExport( + (e) => e.InstallErrorReportingStore && e?.prototype?.Reset && e?.prototype?.componentDidCatch, +) as Component; \ No newline at end of file diff --git a/src/components/index.ts b/src/components/index.ts index fa4cb43..4645947 100755 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -5,6 +5,7 @@ export * from './ControlsList'; export * from './Dialog'; export * from './DialogCheckbox'; export * from './Dropdown'; +export * from './ErrorBoundary'; export * from './Field'; export * from './Focusable'; export * from './FocusRing';