Skip to content

Commit 0a91b75

Browse files
committed
perf: optimize feedback handler with useCallback and fix formatting
1 parent efd9018 commit 0a91b75

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/SupportCaseDetails.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { format } from "date-fns";
44
import { ChevronDownIcon, UserIcon } from "lucide-react";
55
import Link from "next/link";
6-
import { useState } from "react";
6+
import { useCallback, useState } from "react";
77
import { toast } from "sonner";
88
import type { Team } from "@/api/team/get-team";
99
import { Badge } from "@/components/ui/badge";
@@ -47,7 +47,7 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
4747
setRating(starIndex + 1);
4848
};
4949

50-
const handleSendFeedback = async () => {
50+
const handleSendFeedback = useCallback(async () => {
5151
if (rating === 0) {
5252
toast.error("Please select a rating");
5353
return;
@@ -72,7 +72,7 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
7272
console.error("Failed to submit feedback:", error);
7373
toast.error("Failed to submit feedback. Please try again.");
7474
}
75-
};
75+
}, [rating, feedback, ticket.id]);
7676

7777
const handleSendReply = async () => {
7878
if (!team.unthreadCustomerId) {

0 commit comments

Comments
 (0)