🌊 Волна 16: frontend #6 — юзабилити + типы (15 багов)

Юзабилити:
- BUBBLE_MESSAGE_OVERLAP: message/errorMessage взаимоисключение (BubbleWordsPage.tsx)
- REGISTER_FAILURE_NO_RETRY_IN_SESSION: retry с backoff (App.tsx)
- TESTVIEW_DUPLICATE_SAVE: убран дубль saveAnswer (TestViewPage.tsx)
- TEACHER_TOAST_NO_CLEANUP: clearTimeout (TeacherChatPage.tsx)
- TESTVIEW_TOAST_NO_CLEANUP: clearTimeout (TestViewPage.tsx)

Производительность:
- MENU_LEADERBOARD_HEAVY_FETCH: limit 100→50 (MenuPage.tsx)
- FLASHCARDS_RETRACK_ON_ACHIEVEMENT: одноразовый трекинг (FlashcardsPage.tsx)
- TEACHER_HISTORY_SAVE_EVERY_MESSAGE: debounce 500мс (TeacherChatPage.tsx)
- LEADERBOARD_GETUSERID_EVERY_RENDER: useState initializer (LeaderboardPage.tsx)

Типы:
- ANY_TYPES_PERSONAL_STATS + ADMIN_STATS: интерфейсы (api.ts)
- ANY_TYPES_LESSON_FULL: LessonFullResponse (api.ts)

Качество:
- SILENT_ERROR_SWALLOWING_APP: console.warn (App.tsx)
- STALE_CLOSURE_NAVIGATE_SETLANG: useRef для navigate/setLang (App.tsx)
- FETCH_JSON_NO_CONTENT_TYPE_CHECK: проверка content-type (api.ts)

Пропущено осознанно:
- INIT_DATA_IN_URL_DELETE_FEED (Cloudflare preflight)

Аудит v4: Issue #6, frontend 15/16 задач
This commit is contained in:
2026-09-24 20:00:59 +03:00
parent 87f482861b
commit 5c27b98f4b
8 changed files with 221 additions and 56 deletions
+22 -19
View File
@@ -146,12 +146,30 @@ const FlashcardsPage: React.FC = () => {
}
};
// 🔧 ФИКС (24.09.2026): FLASHCARDS_RETRACK_ON_ACHIEVEMENT —
// вынесли трекинг в отдельный useEffect с [] (одноразовый),
// чтобы showAchievement не вызывал повторный трекинг при смене identity.
useEffect(() => {
window.scrollTo(0, 0);
isMountedRef.current = true;
return () => {
isMountedRef.current = false;
if (audioRef.current) {
audioRef.current.pause();
audioRef.current = null;
}
if (audioUrlRef.current) {
try { URL.revokeObjectURL(audioUrlRef.current); } catch { /* ignore */ }
audioUrlRef.current = null;
}
if ('speechSynthesis' in window) {
window.speechSynthesis.cancel();
}
};
}, []);
// 🔧 ИСПРАВЛЕНО: Трекинг только для Алфавита (активная вкладка по умолчанию)
// Одноразовый трекинг при монтировании
useEffect(() => {
trackAlphabetOpened()
.then((data: any) => {
if (data?.new_achievements && data.new_achievements.length > 0) {
@@ -165,23 +183,8 @@ const FlashcardsPage: React.FC = () => {
}
})
.catch(() => {});
return () => {
isMountedRef.current = false;
if (audioRef.current) {
audioRef.current.pause();
audioRef.current = null;
}
// 🔧 ФИКС (24.09.2026): URL_LEAK_FLASHCARDS — освобождаем URL при unmount
if (audioUrlRef.current) {
try { URL.revokeObjectURL(audioUrlRef.current); } catch { /* ignore */ }
audioUrlRef.current = null;
}
if ('speechSynthesis' in window) {
window.speechSynthesis.cancel();
}
};
}, [showAchievement]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// 🔧 ИСПРАВЛЕНО: switchTab теперь сбрасывает window scroll
const switchTab = (tab: TabType) => {