You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: an expired IAP sign-in reloads the page instead of failing every background request - #125
Background requests on the Sessions and review pages detect IAP's sign-in redirect (redirect: 'manual'). The page reloads once when the tab is visible and nothing typed would be lost; otherwise it says to reload.
… background request
Background requests use redirect: 'manual', so IAP's redirect to Google is seen as a sign-out. The page
reloads once when nothing would be lost, and otherwise says to reload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
The reason will be displayed to describe this comment to others. Learn more.
No issues found. Checked that every UI fetch goes through apiRequest, that no /s//api route redirects on its own (signed-out answers 401), that an automatic reload never happens with a typed draft, a focused field or a hidden tab, and that the Sessions page retries the reload when its tab becomes visible again. Any text input with a value (a filter box too) blocks the automatic reload; the banner covers that case.
This PR adds recovery from expired IAP sign-ins to the Sessions and review pages, replacing repeated background-request failures with a guarded reload or a sign-in notice.
Changes:
Detect authentication redirects in shared UI requests and Sessions polling.
Attempt automatic reloads when the page is visible and editing safeguards allow them; otherwise offer manual recovery.
Add tests for redirect detection, reload guards, and signed-out notices.
File
Description
packages/ui/tests/sign-in.test.tsx
Tests request handling, reload guards, and banner rendering.
packages/ui/src/root.tsx
Mounts the signed-out banner.
packages/ui/src/lib/sign-in.ts
Tracks signed-out state and guards automatic reloads.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Pending saves remain unprotected until their responses arrive, allowing an authentication-triggered reload to discard unsaved edits while a PATCH is still in flight.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A failed comment save clears reload protection while unsaved text remains hidden in React state, allowing a later sign-out-triggered reload to discard the edit.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Failed comment saves can allow reloads to discard unsaved edits
packages/ui/src/lib/request.ts:22
If a comment save returns HTTP 500 or rejects with a network error, this finally clears its reload protection even though CommentBubble.handleSave() has hidden the editor and retained the unsaved text in React state. A later background request detecting sign-out can then trigger an automatic reload and discard that edit. Track unsuccessful writes separately from authentication state so they continue to block automatic reload, or keep the editor visible until saving succeeds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background requests on the Sessions and review pages detect IAP's sign-in redirect (redirect: 'manual'). The page reloads once when the tab is visible and nothing typed would be lost; otherwise it says to reload.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w