Skip to content

Story/RSS-CORE-00_fixAppHeader - #23

Merged
dilmun1101 merged 2 commits into
feature/authfrom
story/RSS-CORE-00_fixAppHeader
Jul 7, 2026
Merged

dilmun1101 merged 2 commits into
feature/authfrom
story/RSS-CORE-00_fixAppHeader

Conversation

@dilmun1101

@dilmun1101 dilmun1101 commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

📋 Trello Task ID

  • RSS-SE-## (Task ID / Trello Card)
  • No ID (Global fix or chore)

⚡️ 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

    • Удалена устаревшая логика проверки авторизации и обновлен способ отображения кнопки выхода.

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swagger-editor-app Ready Ready Preview, Comment Jul 7, 2026 10:34am

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Изменена логика выхода из системы: signOut больше не обрабатывает ошибку от supabase.auth.signOut() и всегда редиректит на /login. Удалён статичный флаг isAuthenticated. Header теперь определяет состояние аутентификации через getCurrentUser(). PrivateNavigation вызывает signOut через action формы.

Changes

Аутентификация и навигация в хедере

Layer / File(s) Summary
Упрощение signOut
src/features/auth/model/action.ts
Убрана обработка ошибки supabase.auth.signOut(), редирект на /login теперь безусловный.
Header на getCurrentUser
src/widgets/header/ui/header.tsx, src/shared/lib/auth/is-authenticated.ts
Удалён экспортируемый флаг isAuthenticated; Header получает пользователя через getCurrentUser() и переключает PrivateNavigation/PublicNavigation по наличию user.
signOut через form action
src/widgets/header/ui/private-navigation/private-navigation.tsx
Кнопка выхода обёрнута в form с action={signOut} вместо прямого рендера Button.

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')
Loading

Possibly related PRs

  • FierceSloth/swagger-editor-app#18: PR #18 изменяет ту же функцию signOut в src/features/auth/model/action.ts, добавляя возврат мапированных ошибок через mapAuthError, тогда как этот PR убирает обработку ошибок.

Suggested reviewers: FierceSloth, lexarudak

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning Описание почти заполнено, но для UI-изменений отсутствует обязательный раздел со скриншотами/GIF. Добавьте раздел Screenshots/GIFs с изображениями или GIF, либо удалите его только если UI-изменений нет.
Title check ❓ Inconclusive Заголовок похож на имя ветки и не описывает изменение достаточно ясно. Сделайте заголовок короткой фразой о сути, например: «Fix app header sign-out flow».
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch story/RSS-CORE-00_fixAppHeader

Comment @coderabbitai help to get the list of available commands.

@dilmun1101 dilmun1101 changed the title Story/rss core 00 fix app header Story/RSS-CORE-00_fixAppHeader Jul 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between b211512 and 3aa0dcd.

📒 Files selected for processing (4)
  • src/features/auth/model/action.ts
  • src/shared/lib/auth/is-authenticated.ts
  • src/widgets/header/ui/header.tsx
  • src/widgets/header/ui/private-navigation/private-navigation.tsx
💤 Files with no reviewable changes (1)
  • src/shared/lib/auth/is-authenticated.ts

@dilmun1101
dilmun1101 merged commit 9f1f93c into feature/auth Jul 7, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 3aa0dcdc Deployed Jul 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant