Refactor data initialization process

Review and adjust the data initialization logic to ensure proper functionality.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 07:52:45 +00:00
parent 23ba0f7e90
commit c5a5a20d36
6 changed files with 342 additions and 247 deletions

View File

@@ -24,8 +24,23 @@ const DataResetSection = () => {
// 데이터 초기화 수행
try {
console.log('모든 데이터 초기화 시작');
// 초기화 실행 전에 사용자 설정 백업
const dontShowWelcomeValue = localStorage.getItem('dontShowWelcome');
const hasVisitedBefore = localStorage.getItem('hasVisitedBefore');
// 데이터 초기화
resetAllStorageData();
// 사용자 설정 복원
if (dontShowWelcomeValue) {
localStorage.setItem('dontShowWelcome', dontShowWelcomeValue);
}
if (hasVisitedBefore) {
localStorage.setItem('hasVisitedBefore', hasVisitedBefore);
}
// 스토리지 이벤트 트리거하여 다른 컴포넌트에 변경 알림
window.dispatchEvent(new Event('transactionUpdated'));
window.dispatchEvent(new Event('budgetDataUpdated'));
@@ -79,6 +94,7 @@ const DataResetSection = () => {
<DialogTitle> ?</DialogTitle>
<DialogDescription>
, , , .
, '환영합니다' .
</DialogDescription>
</DialogHeader>
<DialogFooter className="flex flex-col sm:flex-row gap-2 sm:gap-0">