Further stabilize transaction deletion

Attempt to further stabilize transaction deletion process and address potential UI freezing issues.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-18 06:26:39 +00:00
parent 6861f4d88b
commit 964b3b6c91
6 changed files with 276 additions and 58 deletions

View File

@@ -4,13 +4,15 @@ import { isSyncEnabled } from '../syncSettings';
import { toast } from '@/hooks/useToast.wrapper';
/**
* 특정 트랜잭션 ID 삭제 처리
* 특정 트랜잭션 ID 삭제 처리 - 안정성 개선 버전
*/
export const deleteTransactionFromServer = async (userId: string, transactionId: string): Promise<void> => {
if (!isSyncEnabled()) return;
try {
console.log(`트랜잭션 삭제 요청: ${transactionId}`);
// 삭제 요청 (타임아웃 처리 없음 - 불필요한 복잡성 제거)
const { error } = await supabase
.from('transactions')
.delete()
@@ -25,11 +27,16 @@ export const deleteTransactionFromServer = async (userId: string, transactionId:
console.log(`트랜잭션 ${transactionId} 삭제 완료`);
} catch (error) {
console.error('트랜잭션 삭제 중 오류:', error);
// 에러 발생 시 토스트 알림
// 오류 메시지 (중요도 낮음)
toast({
title: "삭제 동기화 실패",
description: "서버에서 트랜잭션을 삭제하는데 문제가 발생했습니다.",
variant: "destructive"
title: "동기화 문제",
description: "서버에서 삭제 중 문제가 발생했습니다.",
variant: "default",
duration: 1500
});
// 오류 다시 던지기 (호출자가 처리하도록)
throw error;
}
};