Реал-тайм через SSE (push-to-invalidate): живые приглашения/партии, авто-обновление без перезагрузки

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 22:52:41 +03:00
co-authored by Claude Opus 4.8
parent 16452f7bbe
commit 2500ca575b
15 changed files with 357 additions and 9 deletions
+4
View File
@@ -1,5 +1,7 @@
import { Outlet, useLocation, useNavigate } from "react-router-dom";
import { useMe } from "../hooks/auth";
import { useServerEvents } from "../hooks/useServerEvents";
import { BottomBar } from "./BottomBar";
const TITLES: Record<string, string> = {
@@ -14,6 +16,8 @@ const TITLES: Record<string, string> = {
export function AppShell() {
const location = useLocation();
const navigate = useNavigate();
const { data: me } = useMe();
useServerEvents(!!me); // живые обновления (SSE) только при наличии сессии
const title =
TITLES[location.pathname] ??
(location.pathname.startsWith("/u/") ? "Профиль игрока" : "Forbidden Stars");