Fix data display issues
Addresses issues where budget and expense data were not displaying correctly on the summary cards, category bar graph, and transaction/analytics pages. Also fixes a bug where data was disappearing after input.
This commit is contained in:
@@ -37,11 +37,28 @@ const Index = () => {
|
||||
}
|
||||
}, [isInitialized, checkWelcomeDialogState]);
|
||||
|
||||
// 페이지가 처음 로드될 때 데이터 로딩 확인
|
||||
useEffect(() => {
|
||||
// 데이터 로드 상태 확인
|
||||
console.log('Index 페이지 마운트, 현재 데이터 상태:');
|
||||
console.log('트랜잭션:', transactions.length);
|
||||
console.log('예산 데이터:', budgetData);
|
||||
|
||||
// 수동으로 이벤트 발생시켜 데이터 갱신
|
||||
window.dispatchEvent(new Event('transactionUpdated'));
|
||||
window.dispatchEvent(new Event('budgetDataUpdated'));
|
||||
window.dispatchEvent(new Event('categoryBudgetsUpdated'));
|
||||
}, []);
|
||||
|
||||
// 앱이 포커스를 얻었을 때 데이터를 새로고침
|
||||
useEffect(() => {
|
||||
const handleFocus = () => {
|
||||
console.log('창이 포커스를 얻음 - 데이터 새로고침');
|
||||
// 이벤트 발생시켜 데이터 새로고침
|
||||
window.dispatchEvent(new Event('storage'));
|
||||
window.dispatchEvent(new Event('transactionUpdated'));
|
||||
window.dispatchEvent(new Event('budgetDataUpdated'));
|
||||
window.dispatchEvent(new Event('categoryBudgetsUpdated'));
|
||||
};
|
||||
|
||||
window.addEventListener('focus', handleFocus);
|
||||
|
||||
Reference in New Issue
Block a user