무한 루프 수정 - handleDeleteUser를 useCallback으로 메모이제이션

문제:
- handleDeleteUser가 매 렌더링마다 새로 생성되어 useSetOnRightClick의 useEffect가 무한 실행
- "Maximum update depth exceeded" 에러 발생

수정 사항:
- handleDeleteUser를 useCallback으로 감싸서 메모이제이션
- 의존성 배열에 [mid, usrid, userDelete, navigate, t] 추가
- useEffect 무한 루프 방지

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jay Sheen
2025-11-14 18:26:39 +09:00
parent ad13dca284
commit f16428ff47

View File

@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState, useCallback } from 'react';
import { useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { PATHS } from '@/shared/constants/paths';
@@ -29,7 +29,7 @@ export const UserLoginAuthInfoPage = () => {
const [activeTab, ] = useState<AccountUserTabKeys>(AccountUserTabKeys.LoginAuthInfo);
const handleDeleteUser = async () => {
const handleDeleteUser = useCallback(async () => {
const confirmed = await showConfirm(t('account.deleteUserConfirm', '사용자를 삭제하시겠습니까?'));
if (!confirmed) return;
@@ -44,7 +44,7 @@ export const UserLoginAuthInfoPage = () => {
} catch (error: any) {
snackBar(error.message || t('account.deleteUserFailed', '사용자 삭제를 실패했습니다.'));
}
};
}, [mid, usrid, userDelete, navigate, t]);
useSetHeaderTitle(t('account.userSettings'));
useSetHeaderType(HeaderType.LeftArrow);