fix(tradein): RouteGuard prod 401 → session-expired screen, stop re-subscribe storm (#800) #896

Merged
bot-reviewer merged 1 commit from feat/800-routeguard-401-session-screen into main 2026-05-31 13:17:45 +00:00

1 commit

Author SHA1 Message Date
81cd1f61d3 fix(tradein): RouteGuard prod 401 → session-expired screen, stop re-subscribe storm (#800)
TanStack Query errored queries (staleTime: Infinity) are always stale — each
new observer subscription triggers a refetch regardless of retry:false.
RouteGuard mounting children on 401 caused continuous re-subscribe churn
(616+ requests in 15s confirmed by design-loop repro 2026-05-31).

Fix: on 401 in production, render NoAccessScreen variant="session" instead
of mounting the app subtree. Dev without Caddy keeps the passthrough
(process.env.NODE_ENV !== "production") so local next dev still works.

Also adds NoAccessScreen "session" variant (title: Сессия истекла,
subtitle: Обновите страницу, чтобы войти снова).
2026-05-31 16:07:21 +03:00