Skip to content

Commit da8d316

Browse files
committed
Fix processing state management in report deletion and new upload handlers
1 parent 052bcfe commit da8d316

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

frontend/src/pages/Reports/ReportDetailPage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ const ReportDetailPage: React.FC = () => {
9090
try {
9191
setIsProcessing(true);
9292
await axios.delete(`${API_URL}/api/reports/${reportId}`, await getAuthConfig());
93-
setIsProcessing(false);
9493

9594
// Show toast notification
9695
createToast({
@@ -113,18 +112,21 @@ const ReportDetailPage: React.FC = () => {
113112
duration: 2000,
114113
color: 'danger',
115114
});
115+
} finally {
116+
setIsProcessing(false);
116117
}
117118
};
118119

119120
const handleNewUpload = async (setIsProcessing: (isProcessing: boolean) => void) => {
120121
try {
121122
setIsProcessing(true);
122123
await axios.delete(`${API_URL}/api/reports/${reportId}`, await getAuthConfig());
123-
setIsProcessing(false);
124124

125125
history.push('/tabs/upload');
126126
} catch (error) {
127127
console.error('Error deleting report before new upload:', error);
128+
} finally {
129+
setIsProcessing(false);
128130
}
129131
};
130132

0 commit comments

Comments
 (0)