fix: dashboard 빈 화면 수정 - purgeNonMath 삭제 + API 에러 방어

- purgeNonMath 호출 삭제 (데이터 삭제 위험)
- Promise.all 내 API 호출에 .catch() 추가하여
  하나의 API 실패가 전체 대시보드를 깨지 않도록 방어

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
reloop
2026-04-19 15:18:22 +09:00
parent 46a91023fc
commit 6ad6f7a1ea

View File

@@ -95,15 +95,6 @@ function DashboardBody() {
setCoachDismissed(window.localStorage.getItem(COACH_DISMISS_KEY) === '1'); setCoachDismissed(window.localStorage.getItem(COACH_DISMISS_KEY) === '1');
}, []); }, []);
useEffect(() => {
const purged = localStorage.getItem('reloop-purged-non-math');
if (!purged) {
api.post('/study-logs/purge-non-math').then(() => {
localStorage.setItem('reloop-purged-non-math', 'true');
}).catch(() => {});
}
}, []);
useEffect(() => { useEffect(() => {
let cancelled = false; let cancelled = false;
@@ -115,12 +106,12 @@ function DashboardBody() {
const [meRes, summaryRes, recentRes, activityRes, subjectsRes, orgsRes, classesRes, assignmentsRes, calendarRes] = await Promise.all([ const [meRes, summaryRes, recentRes, activityRes, subjectsRes, orgsRes, classesRes, assignmentsRes, calendarRes] = await Promise.all([
api.get<MeUser>('/auth/me'), api.get<MeUser>('/auth/me'),
api.get<DashboardSummary>('/dashboard/summary'), api.get<DashboardSummary>('/dashboard/summary'),
api.get<StudyLog[]>('/study-logs', { params: { limit: 5 } }), api.get<StudyLog[]>('/study-logs', { params: { limit: 5 } }).catch(() => ({ data: [] as StudyLog[] })),
api.get<StudyLog[]>('/study-logs', { params: { limit: 200 } }), api.get<StudyLog[]>('/study-logs', { params: { limit: 200 } }).catch(() => ({ data: [] as StudyLog[] })),
api.get<SubjectStats[]>('/stats/subjects'), api.get<SubjectStats[]>('/stats/subjects').catch(() => ({ data: [] as SubjectStats[] })),
getMyOrganizations(), getMyOrganizations().catch(() => [] as Organization[]),
getMyClasses(), getMyClasses().catch(() => [] as Awaited<ReturnType<typeof getMyClasses>>),
getAssignments(), getAssignments().catch(() => [] as Awaited<ReturnType<typeof getAssignments>>),
getReviewCalendar(now.getFullYear(), now.getMonth() + 1).catch(() => ({ days: [] as CalendarDay[] })), getReviewCalendar(now.getFullYear(), now.getMonth() + 1).catch(() => ({ days: [] as CalendarDay[] })),
]); ]);