Skip to content

fix stale session cookie#823

Merged
graphite-app[bot] merged 1 commit into
mainfrom
stale-cookie-fix
Apr 3, 2026
Merged

fix stale session cookie#823
graphite-app[bot] merged 1 commit into
mainfrom
stale-cookie-fix

Conversation

@Prasanna721
Copy link
Copy Markdown
Member

  • redirect to login when session is gone instead of blank screen
  • show cached username while session restores so header doesn't flicker
  • cleaned up redundant type casts and unused vars

@graphite-app graphite-app Bot requested a review from Dhravya April 3, 2026 00:59
@claude
Copy link
Copy Markdown

claude Bot commented Apr 3, 2026

Claude finished @Prasanna721's task in 1m 35s —— View job


Reviewed PR #823: fix stale session cookie

  • Get PR diff and understand the changes
  • Check for existing review comments
  • Review for bugs, security issues, and logic errors
  • Submit review summary

Summary: Clean PR with no issues found. The changes properly handle stale sessions by redirecting to login instead of showing a blank screen, and the cached username during restoration prevents header flicker. Code cleanups (removing redundant ?? false, using ViewMode type) are valid.

Score: 10/10 — Good to ship.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 3, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app c012f3b Apr 03 2026, 01:59 AM

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Overview: Fixes stale session handling by redirecting to login when session is lost and showing cached username during session restoration to prevent header flicker.

Issues found: None — this looks good to ship.

Verified:

  • The redirect to /login with proper URL encoding when session is gone after restoration completes
  • feedbackParam uses .withDefault(false) so the ?? false was correctly identified as redundant
  • ViewMode type import is cleaner than the inline union type cast
  • Dependency array reorder in useEffect is cosmetic (React treats deps as a set)

Score: 10/10

@entelligence-ai-pr-reviews
Copy link
Copy Markdown

entelligence-ai-pr-reviews Bot commented Apr 3, 2026

EntelligenceAI PR Summary

Refactors authentication guard and header components to improve session handling correctness and code clarity.

  • EnsureWorkspace: redirects unauthenticated users to /login?redirect=<currentUrl> instead of silently returning; separates isRestoring and !session checks into distinct conditionals
  • Header: conditionally renders localStorageUsername only during auth restoration to avoid stale display post-logout; replaces isFeedbackOpen boolean intermediate with direct feedbackOpen (string | null) prop; replaces hardcoded union type with imported ViewMode type
  • auth-context.tsx: removes redundant type annotation, condenses if block to one line, reorders useEffect dependency array (isSessionPending before session)

Confidence Score: 5/5 - Safe to Merge

Safe to merge — this PR cleanly addresses stale session cookie issues by refactoring EnsureWorkspace to properly redirect unauthenticated users with a ?redirect=<currentURL> parameter, fixing the auth context's isRestoring gating to prevent stale localStorageUsername flashes, and replacing hardcoded union types in Header with the imported ViewMode type for better type safety. No logic bugs, security issues, or regression risks were identified across all three changed files, and the changes are directionally correct improvements to auth correctness and UI consistency.

Key Findings:

  • EnsureWorkspace now correctly redirects unauthenticated users instead of silently returning, which is a meaningful correctness fix that prevents users from landing in an undefined state without feedback.
  • Gating localStorageUsername display on isRestoring in Header properly eliminates the stale data flash race condition that motivated this PR, and the logic appears sound.
  • Replacing the hardcoded union type with the imported ViewMode type in Header is a low-risk, high-value cleanup that improves maintainability and reduces the chance of future type drift.
  • All three changed files were reviewed with no new issues identified, and there are no pre-existing unresolved comments that could indicate hidden risk.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown

Walkthrough

This PR refactors authentication-related components for improved control flow and correctness. EnsureWorkspace now explicitly redirects unauthenticated users to /login with a redirect parameter. Header prevents stale username display after logout and cleans up feedback modal state handling. auth-context.tsx receives minor style and consistency cleanup.

Changes

File(s) Summary
apps/web/components/ensure-workspace.tsx Adds explicit redirect to /login with current URL as redirect query param when session is absent and isRestoring is false; decouples isRestoring and !session into separate conditionals.
apps/web/components/header.tsx Imports ViewMode type from context; uses isRestoring to guard localStorageUsername display; removes intermediate isFeedbackOpen variable, passing feedbackOpen directly to FeedbackModal.
packages/lib/auth-context.tsx Removes explicit type annotation on organizations; condenses single-statement if block; reorders useEffect dependency array for consistency.

🔗 Cross-Repository Impact Analysis

Enable automatic detection of breaking changes across your dependent repositories. → Set up now

Learn more about Cross-Repository Analysis

What It Does

  • Automatically identifies repositories that depend on this code
  • Analyzes potential breaking changes across your entire codebase
  • Provides risk assessment before merging to prevent cross-repo issues

How to Enable

  1. Visit Settings → Code Management
  2. Configure repository dependencies
  3. Future PRs will automatically include cross-repo impact analysis!

Benefits

  • 🛡️ Prevent breaking changes across repositories
  • 🔍 Catch integration issues before they reach production
  • 📊 Better visibility into your multi-repo architecture

@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Apr 3, 2026

Merge activity

- redirect to login when session is gone instead of blank screen
- show cached username while session restores so header doesn't flicker
- cleaned up redundant type casts and unused vars
@graphite-app graphite-app Bot force-pushed the stale-cookie-fix branch from cb896e8 to c012f3b Compare April 3, 2026 01:55
@graphite-app graphite-app Bot merged commit c012f3b into main Apr 3, 2026
8 of 10 checks passed
sreedharsreeram pushed a commit that referenced this pull request Apr 14, 2026
- redirect to login when session is gone instead of blank screen
- show cached username while session restores so header doesn't flicker
- cleaned up redundant type casts and unused vars
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.

2 participants