Story/RSS-CORE-00_fixAppHeader - #23
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughИзменена логика выхода из системы: signOut больше не обрабатывает ошибку от supabase.auth.signOut() и всегда редиректит на /login. Удалён статичный флаг isAuthenticated. Header теперь определяет состояние аутентификации через getCurrentUser(). PrivateNavigation вызывает signOut через action формы. ChangesАутентификация и навигация в хедере
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant PrivateNavigation
participant signOutAction
participant Supabase
User->>PrivateNavigation: отправка формы (кнопка выхода)
PrivateNavigation->>signOutAction: вызов action=signOut
signOutAction->>Supabase: supabase.auth.signOut()
signOutAction->>User: redirect('/login')
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/features/auth/model/action.ts (1)
65-71: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winОшибка от
supabase.auth.signOut()полностью игнорируется.Безусловный редирект на
/loginсоответствует общепринятой практике (logout — best-effort), но полное отсутствие обработкиerrorлишает наблюдаемости: если вызов к Supabase упадёт (сеть, недоступность сервиса), это никак не будет залогировано или отслежено.♻️ Предлагаемое улучшение: логировать ошибку без блокировки редиректа
export async function signOut() { const supabase = await createClient(); - await supabase.auth.signOut(); + const { error } = await supabase.auth.signOut(); + + if (error) { + console.error('signOut error:', error.message); + } redirect('/login'); }Также обратите внимание: раньше функция при ошибке возвращала
AuthActionResult, теперь неявно возвращаетvoid. Единственный известный вызывающий (PrivateNavigation) результат не использует, но стоит убедиться, что других потребителей с зависимостью от прежнего типа возврата нет.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/features/auth/model/action.ts` around lines 65 - 71, In signOut, the supabase.auth.signOut() result is ignored, so add error handling and log any failure while still keeping the unconditional redirect to '/login'. Update the signOut function to capture the returned error from createClient/supabase.auth.signOut and emit a clear log entry via your existing logging mechanism, without blocking redirect. Also verify whether any callers still depend on the previous AuthActionResult return type and adjust the signature or usages accordingly, with signOut and PrivateNavigation as the main symbols to check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/features/auth/model/action.ts`:
- Around line 65-71: In signOut, the supabase.auth.signOut() result is ignored,
so add error handling and log any failure while still keeping the unconditional
redirect to '/login'. Update the signOut function to capture the returned error
from createClient/supabase.auth.signOut and emit a clear log entry via your
existing logging mechanism, without blocking redirect. Also verify whether any
callers still depend on the previous AuthActionResult return type and adjust the
signature or usages accordingly, with signOut and PrivateNavigation as the main
symbols to check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bb948a14-d18e-46e7-bfe0-337d1da66c37
📒 Files selected for processing (4)
src/features/auth/model/action.tssrc/shared/lib/auth/is-authenticated.tssrc/widgets/header/ui/header.tsxsrc/widgets/header/ui/private-navigation/private-navigation.tsx
💤 Files with no reviewable changes (1)
- src/shared/lib/auth/is-authenticated.ts
📋 Trello Task ID
⚡️ Summary
Implement sign out
🛠 Type of change
feat(New feature)fix(Bug fix)refactor(Code improvement / Refactoring without changing logic)style(Formatting, CSS)docs(Documentation)chore(Configs, Build)test(Testing)Summary by CodeRabbit
Bug Fixes
Refactor