Skip to content

Commit 93eb859

Browse files
author
Sébastien Henau
committed
Merge branch 'feature/separate-flare-api-keys' into feature/document-react-improvements
2 parents 3b2250b + 5059bf8 commit 93eb859

File tree

4 files changed

+59
-165
lines changed

4 files changed

+59
-165
lines changed

.claude/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ promise rejections, async errors, component errors, etc.).
9696
## Publishing
9797

9898
- Update `version` in the package's `package.json`
99-
- Run `npm publish` from the individual package directory
99+
- Run `npm publish` from the individual package directory

.claude/docs/projects - react-improvements.md

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@
1414

1515
## FlareErrorBoundary: `fallback` property
1616

17-
### Inspiration
18-
19-
- [Sentry ErrorBoundary `fallback`](https://docs.sentry.io/platforms/javascript/guides/react/features/error-boundary/#fallback-ui-options) -- supports a static element and a render function receiving `{ error, componentStack, resetError }`
20-
- [react-error-boundary](https://github.com/bvaughn/react-error-boundary) -- the most popular standalone error boundary library, supports `fallback`, `fallbackRender`, and `FallbackComponent` as three separate props
21-
2217
### Why
2318

2419
Without a `fallback` prop, the error boundary rendered nothing when an error was caught, giving users no way to
25-
show a recovery UI. Every major competitor supports this.
20+
show a recovery UI.
2621

27-
Our implementation combines the static and render function approaches into a single `fallback` prop (like Sentry), and
22+
Our implementation combines the static and render function approaches into a single `fallback` prop, and
2823
passes `componentStack` as a parsed string array rather than a raw string.
2924

3025
The `fallback` prop accepts either a static `ReactNode` or a render function. The render function receives the caught
@@ -53,12 +48,6 @@ The `fallback` prop accepts either a static `ReactNode` or a render function. Th
5348

5449
## FlareErrorBoundary: `onError` callback
5550

56-
### Inspiration
57-
58-
- [Sentry ErrorBoundary `onError`](https://docs.sentry.io/platforms/javascript/guides/react/features/error-boundary/#options-reference) -- called when the boundary encounters an error
59-
- [react-error-boundary `onError`](https://github.com/bvaughn/react-error-boundary?tab=readme-ov-file#onerror) -- same concept, receives `(error, info)`
60-
61-
6251
### Why
6352

6453
Developers need a hook to perform side effects when an error is caught -- logging to a secondary service,
@@ -77,12 +66,6 @@ showing a toast, updating app state, etc. This fires *after* the error has been
7766

7867
## FlareErrorBoundary: `beforeCapture` callback
7968

80-
### Inspiration
81-
82-
- [Sentry ErrorBoundary `beforeCapture`](https://docs.sentry.io/platforms/javascript/guides/react/features/error-boundary/#options-reference) -- the only competitor that offers this; receives the Sentry scope to set tags and context before the event is sent
83-
84-
No other competitor (Datadog, Bugsnag, Rollbar, LogRocket) provides an equivalent hook.
85-
8669
### Why
8770

8871
Fires *before* the error is reported to Flare, giving developers a chance to attach custom context, tags, or
@@ -102,11 +85,6 @@ the developer decide what to include rather than trying to automatically seriali
10285

10386
## FlareErrorBoundary: `onReset` property (with previous error)
10487

105-
### Inspiration
106-
107-
- [react-error-boundary `onReset`](https://github.com/bvaughn/react-error-boundary?tab=readme-ov-file#onreset) -- the primary inspiration; called when the boundary resets, receives details about what triggered the reset
108-
- [Sentry ErrorBoundary `onReset`](https://github.com/getsentry/sentry-javascript/blob/master/packages/react/src/errorboundary.tsx) -- exists in Sentry's source code (receives `error, componentStack, eventId`) but is not documented in their official docs
109-
11088
### Why
11189

11290
When the error boundary resets (either via `resetErrorBoundary()` from the fallback or via `resetKeys`
@@ -129,14 +107,6 @@ error allows conditional cleanup based on what went wrong.
129107

130108
## FlareErrorBoundary: `resetKeys` property
131109

132-
### Inspiration
133-
134-
- [react-error-boundary `resetKeys`](https://github.com/bvaughn/react-error-boundary?tab=readme-ov-file#resetkeys) -- the sole source for this pattern; Sentry does not offer it
135-
136-
This is a feature unique to react-error-boundary that neither Sentry nor any other error tracking competitor provides.
137-
When any value in the `resetKeys` array changes between renders (compared via `Object.is`), the boundary automatically
138-
resets and re-renders its children.
139-
140110
### Why
141111

142112
Allows automatic reset of the error boundary when certain values change. Common use case: resetting the
@@ -165,19 +135,16 @@ function App() {
165135

166136
### Inspiration
167137

168-
- [Sentry `reactErrorHandler`](https://docs.sentry.io/platforms/javascript/guides/react/features/error-boundary/#error-hooks-vs-errorboundary) -- provides `Sentry.reactErrorHandler()` for all three React 19 root error hooks, with an optional callback parameter
169138
- [React 19 `createRoot` error handling docs](https://react.dev/reference/react-dom/client/createRoot#parameters) -- the React docs describing `onCaughtError`, `onUncaughtError`, and `onRecoverableError`
170139

171-
Our API mirrors Sentry's approach: a wrapper function that accepts an optional callback. The key difference is that
172-
`flareReactErrorHandler` also handles non-Error values (strings, objects) by converting them to proper Error instances
173-
via `convertToError()`, making it more resilient to edge cases.
174-
175140
### Why
176141

177142
React 19 introduced `onCaughtError`, `onUncaughtError`, and `onRecoverableError` callbacks on `createRoot`.
178-
These are root-level error handlers that catch errors *without* requiring an ErrorBoundary wrapper. At the time of
179-
implementation, only Sentry and Datadog supported this -- Bugsnag, Rollbar, and LogRocket did not. This puts Flare ahead
180-
of most competitors for React 19 support.
143+
These are root-level error handlers that catch errors *without* requiring an ErrorBoundary wrapper.
144+
145+
`flareReactErrorHandler` is a wrapper function that accepts an optional callback. It also handles non-Error values
146+
(strings, objects) by converting them to proper Error instances via `convertToError()`, making it more resilient to
147+
edge cases.
181148

182149
```tsx
183150
import { flareReactErrorHandler } from '@flareapp/react';
@@ -198,4 +165,4 @@ const root = createRoot(document.getElementById('root')!, {
198165
});
199166

200167
root.render(<App />);
201-
```
168+
```

0 commit comments

Comments
 (0)