fix(admin-ui): top-5 critical review bugs (auth + AJV + TZ + idempotency + storage)

This commit is contained in:
Александр Зимин
2026-05-10 16:22:35 +00:00
parent f2614244bf
commit fc2fb35717
8 changed files with 292 additions and 72 deletions
+13 -3
View File
@@ -26,12 +26,22 @@ export function RequireAuth({ children }: { children: ReactNode }) {
if (oidcError) return
if (auth.isLoading || auth.activeNavigator) return
if (auth.isAuthenticated) return
// Critical guard: auth.error → signinRedirect уже упал (Keycloak недоступен,
// OIDC discovery 404 etc). Без этого guard'а useEffect зациклится: каждый
// failed redirect ставит auth.error → re-render → guard не срабатывает →
// снова signinRedirect. С guard'ом UI показывает "Не удалось подключиться"
// блок ниже (использует auth.error.message).
if (auth.error) return
auth.signinRedirect().catch((err) => {
// Не уйти на signinRedirect = Keycloak недоступен. Логируем, дальше
// покажем сообщение об ошибке (auth.error будет выставлен).
console.error('[auth] signinRedirect failed', err)
})
}, [auth.isAuthenticated, auth.isLoading, auth.activeNavigator, oidcError])
}, [
auth.isAuthenticated,
auth.isLoading,
auth.activeNavigator,
auth.error,
oidcError,
])
if (oidcError) {
return (