diff --git a/package-lock.json b/package-lock.json
index 7e25e61..319ccc8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,7 @@
"examples/*"
],
"dependencies": {
- "bugsplat": "^9.1.0"
+ "bugsplat": "^9.1.1"
},
"devDependencies": {
"@bugsplat/js-api-client": "^2.0.0",
@@ -4154,9 +4154,9 @@
"license": "MIT"
},
"node_modules/bugsplat": {
- "version": "9.1.0",
- "resolved": "https://registry.npmjs.org/bugsplat/-/bugsplat-9.1.0.tgz",
- "integrity": "sha512-QIfY6kMtlMwJQz2Beg42QJ65TgkKP49jv5zBVCX2X86CDdCRFY0i/B9s1k3aqElJMRLVkiWxUut6FRTn2Xx5fQ==",
+ "version": "9.1.1",
+ "resolved": "https://registry.npmjs.org/bugsplat/-/bugsplat-9.1.1.tgz",
+ "integrity": "sha512-uAzCh6lVhfDFctIdXOMlqv4HUsbePDrvLX87KcC6zC8YaZ2SSZfvRxeFJNnoUc4aui0aqY3uCMKSz1lo5x0oxg==",
"license": "MIT",
"engines": {
"node": ">=16.0.0",
diff --git a/package.json b/package.json
index ae827be..e273be2 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
"author": "zmrl",
"license": "MIT",
"dependencies": {
- "bugsplat": "^9.1.0"
+ "bugsplat": "^9.1.1"
},
"devDependencies": {
"@bugsplat/js-api-client": "^2.0.0",
diff --git a/spec/ErrorBoundary.spec.tsx b/spec/ErrorBoundary.spec.tsx
index fc978fd..63dedad 100644
--- a/spec/ErrorBoundary.spec.tsx
+++ b/spec/ErrorBoundary.spec.tsx
@@ -152,7 +152,7 @@ describe('', () => {
await waitFor(() => expect(mockPost).toHaveBeenCalledTimes(1));
});
- it('should attach componentStack as a text/plain Blob by default', async () => {
+ it('should attach componentStack as a Blob', async () => {
render(
@@ -169,24 +169,6 @@ describe('', () => {
expect(attachment.data.type).toBe('text/plain');
});
- it('honors scope.getCreateComponentStackAttachment() when provided', async () => {
- const customAttachment = { filename: 'componentStack.txt', data: 'CUSTOM' };
- const customBuilder = jest.fn(() => customAttachment);
- const scopeWithBuilder = new Scope(bugSplat, customBuilder);
-
- render(
-
-
-
- );
-
- await waitFor(() => expect(mockPost).toHaveBeenCalledTimes(1));
-
- expect(customBuilder).toHaveBeenCalledWith(expect.stringContaining('BlowUp'));
- const [, options] = mockPost.mock.calls[0];
- expect(options.attachments).toEqual([customAttachment]);
- });
-
it('should call beforePost', async () => {
render(
;
+ scope: { getClient(): BugSplat | null };
}
export type ErrorBoundaryProps = JSX.LibraryManagedAttributes<
@@ -199,7 +197,7 @@ export class ErrorBoundary extends Component<
onResetKeysChange: noop,
onUnmount: noop,
disablePost: false,
- scope: appScope,
+ scope: { getClient: getBugSplat },
};
state = INITIAL_STATE;
@@ -247,7 +245,7 @@ export class ErrorBoundary extends Component<
return client.post(error, {
attachments: componentStack
- ? [scope.getCreateComponentStackAttachment()(componentStack)]
+ ? [{ filename: 'componentStack.txt', data: new Blob([componentStack], { type: 'text/plain' }) }]
: [],
});
}
diff --git a/src/index.ts b/src/index.ts
index da28709..13832a0 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -7,7 +7,6 @@ export type {
export * from './appScope';
export * from './ErrorBoundary';
-export * from './scope';
export * from './useErrorHandler';
export * from './useFeedback';
export * from './withErrorBoundary';
diff --git a/src/scope.ts b/src/scope.ts
index 3b303ca..214c01c 100644
--- a/src/scope.ts
+++ b/src/scope.ts
@@ -1,30 +1,10 @@
-import type { BugSplat, BugSplatAttachment } from 'bugsplat';
+import type { BugSplat } from 'bugsplat';
/**
- * Builds the componentStack attachment for ErrorBoundary posts.
- */
-export type CreateComponentStackAttachment = (
- componentStack: string
-) => BugSplatAttachment;
-
-/**
- * Default builder — wraps the stack in a `text/plain` `Blob`.
- */
-export const defaultCreateComponentStackAttachment: CreateComponentStackAttachment = (
- componentStack
-) => ({
- filename: 'componentStack.txt',
- data: new Blob([componentStack], { type: 'text/plain' }),
-});
-
-/**
- * Encapsulate BugSplat client instance and scope-level overrides.
+ * Encapsulate BugSplat client instance
*/
export class Scope {
- constructor(
- private client: BugSplat | null = null,
- private createComponentStackAttachment: CreateComponentStackAttachment = defaultCreateComponentStackAttachment
- ) {}
+ constructor(private client: BugSplat | null = null) {}
/**
* @returns BugSplat client instance or null if unset
@@ -36,15 +16,4 @@ export class Scope {
setClient(client: BugSplat) {
this.client = client;
}
-
- /**
- * @returns the current componentStack attachment builder
- */
- getCreateComponentStackAttachment() {
- return this.createComponentStackAttachment;
- }
-
- setCreateComponentStackAttachment(fn: CreateComponentStackAttachment) {
- this.createComponentStackAttachment = fn;
- }
}