mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-21 21:09:49 +08:00
30 lines
648 B
TypeScript
30 lines
648 B
TypeScript
"use client";
|
|
|
|
import * as Sentry from "@sentry/nextjs";
|
|
import { useUser } from "@stackframe/stack";
|
|
import { Suspense, useEffect } from "react";
|
|
|
|
// ensure that the polyfills are loaded even on the client
|
|
import "../polyfills";
|
|
|
|
export function ClientPolyfill() {
|
|
return <Suspense fallback={null}><InnerClientPolyfill /></Suspense>;
|
|
}
|
|
|
|
function InnerClientPolyfill() {
|
|
const user = useUser();
|
|
|
|
useEffect(() => {
|
|
Sentry.setUser(user ? {
|
|
id: user.id,
|
|
username: user.displayName ?? user.primaryEmail ?? user.id,
|
|
email: user.primaryEmail ?? undefined,
|
|
} : null);
|
|
|
|
return () => {};
|
|
}, [user]);
|
|
|
|
|
|
return null;
|
|
}
|