-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nextjs): Instrument SSR page components #9346
Conversation
size-limit report 📦
|
8d9bd40
to
91652f4
Compare
|
||
function isReactClassComponent(target: unknown): target is ClassComponent { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
return typeof target === 'function' && target?.prototype?.isReactComponent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LETS GOO
export function wrapPageComponentWithSentry(pageComponent: FunctionComponent | ClassComponent): unknown { | ||
if (isReactClassComponent(pageComponent)) { | ||
return class SentryWrappedPageComponent extends pageComponent { | ||
public render(...args: unknown[]): unknown { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: I wonder if we can use suspense + error boundary to catch this - it's what is recommended with reactjs/rfcs#215
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SSR error boundaries are effectively only needed when you want to display a fallback in case of an error. I don't think we need this and I don't think this is possible in non React Server Component worlds but there's an excellent article on this: https://gal.hagever.com/posts/react-error-boundaries-and-ssr
Ref #9152
Adds error reporting around render functions in Next.js page components. This doesn't include tracing for the errors yet. Because it is a bit involved to add tracing we will do it in a follow up PR.