Keep the user signed in when the Pod is out of reach - #343
Merged
Conversation
A Solid session only becomes live once the provider answers a refresh, so a cold start with no network cannot have one. `isLoggedIn` was the app's single answer to "who is this?", and offline it said nobody: the nav offered to sign them in, `/` opened the landing page, the sign-in nudges appeared — and, because the PouchDB namespace is derived from the pod URL read over the network, the app fell back to the empty `local` database and their lists were not on screen at all. Nothing was lost, but there is no way to tell that from the outside, which is why this reads as "it logged me out again". `SolidPodContext` now has a third state. `isReconnecting` means a session is stored on this device and nothing has told us it is over: the user is signed in and merely unreachable, so the account stays in the nav behind an "Offline" badge, a quiet banner says why the Pod is silent and that changes will sync later, `/` still opens on the lists, and the sign-in prompts stay quiet. `rememberedSession.ts` is what makes that possible across a reload: the WebID and the resolved pod namespace are kept from the last live session, so the right database opens with no network at all. Neither is a credential — the refresh token stays in IndexedDB, owned by the auth library — and both are forgotten the moment the session genuinely ends: a deliberate logout, the provider rejecting the grant, or a start that finds no stored session. Also claims the mid-session case: a live session going inactive without the provider saying anything (the token lapsing while the radio is down) now books its own retry, where before neither backoff covered it. The account menu therefore no longer means "the pod is reachable", so the e2e helper for a live session waits for the offline banner to be absent too, and J's new list-writing test gets its own pod user rather than sharing testuser. docs/offline.md has the whole story, including where offline-first goes next. Closes #342 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013WZr2RLkPKVWcRtMxzJc6x
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A Solid session only becomes live once the provider answers a refresh, so a
cold start with no network cannot have one.
isLoggedInwas the app's singleanswer to "who is this?", and offline it said nobody: the nav offered to sign
them in,
/opened the landing page, the sign-in nudges appeared — and,because the PouchDB namespace is derived from the pod URL read over the
network, the app fell back to the empty
localdatabase and their lists werenot on screen at all. Nothing was lost, but there is no way to tell that from
the outside, which is why this reads as "it logged me out again".
SolidPodContextnow has a third state.isReconnectingmeans a session isstored on this device and nothing has told us it is over: the user is signed
in and merely unreachable, so the account stays in the nav behind an "Offline"
badge, a quiet banner says why the Pod is silent and that changes will sync
later,
/still opens on the lists, and the sign-in prompts stay quiet.rememberedSession.tsis what makes that possible across a reload: the WebIDand the resolved pod namespace are kept from the last live session, so the
right database opens with no network at all. Neither is a credential — the
refresh token stays in IndexedDB, owned by the auth library — and both are
forgotten the moment the session genuinely ends: a deliberate logout, the
provider rejecting the grant, or a start that finds no stored session.
Also claims the mid-session case: a live session going inactive without the
provider saying anything (the token lapsing while the radio is down) now books
its own retry, where before neither backoff covered it.
The account menu therefore no longer means "the pod is reachable", so the e2e
helper for a live session waits for the offline banner to be absent too, and
J's new list-writing test gets its own pod user rather than sharing testuser.
docs/offline.md has the whole story, including where offline-first goes next.
Closes #342
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_013WZr2RLkPKVWcRtMxzJc6x