feat: integrate Sentry for error tracking and enhance user notifications
- Added Sentry integration for error tracking across various components, including error boundaries and user actions. - Updated global error handling to capture exceptions and provide detailed feedback to users. - Enhanced user notifications with toast messages for actions such as credit management, image generation, and canvas exports. - Improved user experience by displaying relevant messages during interactions, ensuring better visibility of system states and errors.
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import { useMutation, useQuery } from "convex/react";
|
||||
import { api } from "@/convex/_generated/api";
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { toast } from "@/lib/toast";
|
||||
import { msg } from "@/lib/toast-messages";
|
||||
|
||||
/**
|
||||
* Initialisiert die Credit-Balance für neue User.
|
||||
@@ -17,16 +19,27 @@ export function InitUser() {
|
||||
session?.user ? {} : "skip"
|
||||
);
|
||||
const initBalance = useMutation(api.credits.initBalance);
|
||||
const initStartedRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
session?.user &&
|
||||
balance &&
|
||||
balance.balance === 0 &&
|
||||
balance.monthlyAllocation === 0
|
||||
!session?.user ||
|
||||
!balance ||
|
||||
balance.balance !== 0 ||
|
||||
balance.monthlyAllocation !== 0
|
||||
) {
|
||||
initBalance();
|
||||
return;
|
||||
}
|
||||
if (initStartedRef.current) return;
|
||||
initStartedRef.current = true;
|
||||
|
||||
void initBalance()
|
||||
.then(() => {
|
||||
toast.success(msg.auth.initialSetup.title, msg.auth.initialSetup.desc);
|
||||
})
|
||||
.catch(() => {
|
||||
initStartedRef.current = false;
|
||||
});
|
||||
}, [session?.user, balance, initBalance]);
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user