Skip to content

Commit 29137aa

Browse files
committed
fix clean error handling and lint issues
1 parent 047b8d2 commit 29137aa

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

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

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,36 +71,29 @@ function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
7171
// Set degraded state for warning banner
7272
setStatusCheckFailed(true);
7373

74-
// Throw a custom error that React Query will catch, but the UI will handle gracefully
75-
// This prevents treating the error as "no feedback exists" which could cause duplicates
76-
throw new Error(`Status check failed: ${errorMessage}`);
74+
// Don't throw; let the query return a safe fallback to avoid retries and duplicate analytics
75+
return;
7776
};
7877

7978
// Check if feedback has already been submitted for this ticket
8079
const feedbackStatusQuery = useQuery({
8180
queryKey: ["feedbackStatus", ticket.id],
8281
queryFn: async () => {
83-
try {
84-
const result = await checkFeedbackStatus(ticket.id);
85-
if ("error" in result) {
86-
// Use shared error handler to maintain consistent behavior
87-
handleStatusCheckError(result.error);
88-
// This line is unreachable but needed for TypeScript
89-
return false;
90-
}
91-
92-
// Clear degraded state on success
93-
if (statusCheckFailed) setStatusCheckFailed(false);
94-
95-
return result.hasFeedback;
96-
} catch (error) {
97-
// Use shared error handler to maintain consistent behavior
98-
handleStatusCheckError(error);
82+
const result = await checkFeedbackStatus(ticket.id);
83+
if ("error" in result) {
84+
handleStatusCheckError(result.error);
85+
return false; // Non-blocking: allow feedback submission despite status check failure
9986
}
87+
88+
// Clear degraded state on success
89+
if (statusCheckFailed) setStatusCheckFailed(false);
90+
91+
return result.hasFeedback;
10092
},
10193
enabled: ticket.status === "closed",
10294
staleTime: 60_000,
10395
gcTime: 5 * 60_000,
96+
retry: 1, // Reduce retries since we want non-blocking behavior
10497
});
10598

10699
const feedbackSubmitted = feedbackStatusQuery.data ?? false;

0 commit comments

Comments
 (0)