Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

set sentry user ID, if available and applicable

Amruth Pillai9af9a0284e77
diff --git a/client/wrappers/SentryWrapper.tsx b/client/wrappers/SentryWrapper.tsx
new file mode 100644
index 000000000..0895a187c
--- /dev/null
+++ b/client/wrappers/SentryWrapper.tsx
@@ -0,0 +1,17 @@
+import * as Sentry from '@sentry/nextjs';
+import { useEffect } from 'react';
+
+import { useAppSelector } from '@/store/hooks';
+
+const SentryWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
+ const user = useAppSelector((state) => state.auth.user);
+
+ useEffect(() => {
+ const sentryUser: Sentry.User | null = user && { ...user, id: user?.id.toString() };
+ Sentry.setUser(sentryUser);
+ }, [user]);
+
+ return <>{children}</>;
+};
+
+export default SentryWrapper;
diff --git a/client/wrappers/index.tsx b/client/wrappers/index.tsx
index 7251792e2..27060c2a2 100644
--- a/client/wrappers/index.tsx
+++ b/client/wrappers/index.tsx
@@ -1,17 +1,18 @@
import DateWrapper from './DateWrapper';
import FontWrapper from './FontWrapper';
+import SentryWrapper from './SentryWrapper';
import ThemeWrapper from './ThemeWrapper';
-const WrapperRegistry: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
- return (
- <ThemeWrapper>
- <FontWrapper>
- <DateWrapper>
+const WrapperRegistry: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
+ <ThemeWrapper>
+ <FontWrapper>
+ <DateWrapper>
+ <SentryWrapper>
<>{children}</>
- </DateWrapper>
- </FontWrapper>
- </ThemeWrapper>
- );
-};
+ </SentryWrapper>
+ </DateWrapper>
+ </FontWrapper>
+ </ThemeWrapper>
+);
export default WrapperRegistry;