문서 파일 정리
This commit is contained in:
@@ -5,6 +5,7 @@ import { useAuth } from '@/contexts/auth/useAuth';
|
||||
import { toast } from '@/hooks/useToast.wrapper';
|
||||
import { saveTransactionsToStorage } from './storageUtils';
|
||||
import { deleteTransactionFromServer } from '@/utils/sync/transaction/deleteTransaction';
|
||||
import { addToDeletedTransactions } from '@/utils/sync/transaction/deletedTransactionsTracker';
|
||||
|
||||
/**
|
||||
* 안정화된 트랜잭션 삭제 훅 - 완전 재구현 버전
|
||||
@@ -49,6 +50,14 @@ export const useDeleteTransaction = (
|
||||
// 트랜잭션 찾기
|
||||
const updatedTransactions = transactions.filter(t => t.id !== id);
|
||||
|
||||
// 삭제된 트랜잭션 추적 목록에 추가
|
||||
try {
|
||||
addToDeletedTransactions(id);
|
||||
console.log(`[안정화] 삭제된 트랜잭션 추적 추가 (ID: ${id})`);
|
||||
} catch (trackingError) {
|
||||
console.error('[안정화] 삭제 추적 실패:', trackingError);
|
||||
}
|
||||
|
||||
// 로컬 스토리지 저장
|
||||
try {
|
||||
saveTransactionsToStorage(updatedTransactions);
|
||||
@@ -111,8 +120,10 @@ export const useDeleteTransaction = (
|
||||
|
||||
// 컴포넌트 언마운트 시 모든 상태 정리
|
||||
useEffect(() => {
|
||||
// 현재 ref 값을 로컬 변수에 복사하여 클린업 함수에서 사용
|
||||
const pendingDeletion = pendingDeletionRef.current;
|
||||
return () => {
|
||||
pendingDeletionRef.current.clear();
|
||||
pendingDeletion.clear();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user