Skip to content

Conversation

@coder77ai
Copy link

@coder77ai coder77ai commented Dec 3, 2025

Closes #171

📝 Description

The issue was the "Signed in!" toast message appears repeatedly whenever the browser tab is minimized and re-focused.
This was caused by the Supabase SIGNED_IN auth event firing again during session refresh, which happens automatically when the tab regains focus.

🔧 Changes Made

The PR adds a guard so the toast only triggers when the authentication state actually changes.

case "SIGNED_IN":

if (!isAuthenticated) {
setIsAuthenticated(true);
toast.success("Signed in!");
}
break;

case "SIGNED_OUT":
if (isAuthenticated) {
setIsAuthenticated(false);
setRepoData(null);
toast.success("Signed out!");
}
break;

Summary by CodeRabbit

  • Bug Fixes
    • Improved authentication event handling to prevent redundant state updates and duplicate notifications. The sign-in and sign-out flows now include guards to ensure state transitions occur only when necessary.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

The pull request adds conditional guards to authentication event handlers in frontend/src/App.tsx to prevent redundant state updates and duplicate toast notifications. The SIGNED_IN handler now only shows the "Signed in!" toast if not already authenticated, and the SIGNED_OUT handler only clears state if currently authenticated.

Changes

Cohort / File(s) Summary
Authentication event handler guards
frontend/src/App.tsx
Added conditional checks to SIGNED_IN and SIGNED_OUT event handlers to prevent duplicate toast notifications and unnecessary state updates when authentication state has not changed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • [bugfix]: Fix frontend build errors #79: Introduced the initial isAuthenticated state and authentication handlers that this PR now enhances with conditional guards to prevent redundant notifications.

Suggested reviewers

  • chandansgowda

Poem

🐰 A hop, a skip, through tabs we go,
Yet toasts don't show where once they'd flow,
With guards so wise and checks so keen,
Each sign-in shows just once—pristine!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title '#171 Issue: Update App.tsx' is vague and generic, using only a reference number and filename without describing the actual fix or change made. Use a more descriptive title that explains the fix, such as 'Fix: Prevent auth toast from reappearing on tab switch' or 'Add guards to prevent duplicate auth notifications'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The code changes correctly implement the guard logic specified in issue #171 by adding isAuthenticated checks before displaying toast notifications on auth state changes.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the auth toast repetition issue; no unrelated modifications to other features or functionality are present.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8eeacad and f6e92a0.

📒 Files selected for processing (1)
  • frontend/src/App.tsx (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Bug Report: “Signed in!” Toast Reappears When Switching Tabs

2 participants