Fix 1.36.9: email login hands back to the waiting tab, top bar refreshes after sign-in #87
No reviewers
Labels
No labels
audit
bug
cleanup
docs
duplicate
enhancement
help wanted
invalid
new feature
P0
P1
P2
P3
question
roadmap
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
pyaniz/Thursday!87
Loading…
Reference in a new issue
No description provided.
Delete branch "staging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: Fix (patch) - VERSION 1.36.8 -> 1.36.9.
Bug 1: email magic link
The link authenticated the tab it was opened in while the tab that asked for it kept waiting. The waiting tab did have a watcher (BroadcastChannel +
/auth/mepolling), but it polled only while visible, never asked again when brought back to the foreground, used a hard reload, and gave no hint when the link points at a different address than the one the tab is on. Now:/auth/me), carries on into the app, and the link tab shows "You are signed in. Return to the tab where you asked for the link" (trieswindow.close(), offers Continue in this tab instead). With no waiting tab it carries on as before.visibilitychange,focusandpageshow, plus an I opened the link button. Transport is BroadcastChannel and thestorageevent (shared/utils/authEvents.ts)./auth/confignow returnspublic_url; the login page warns when it differs from the current origin (links would sign in another site, a tab can never follow that).Bug 2: top bar not refreshing
AuthContext.login()is now the single place that finishes a sign-in: sets the user, completes it from/auth/me, and tells the other tabs. The group wizard's sign-in only wrote localStorage and never updated the app (the likeliest cause of the stale top bar); the Discord callback now useslogin()too.AuthContextre-syncs onlogin/logoutevents from other tabs and when a tab returns to view (throttled to once per 10 s); logout also broadcasts.GroupContextreloads groups whenever the logged-in user changes.Not covered (by design)
The session is only issued to the browser that opens the link (same rule as the Telegram flow). If the email app opens the link in a different browser, an installed app or another device, the waiting tab cannot follow; a server-side hand-over would let anyone who tricks you into clicking a link sign in their own browser as you, so I did not add one.
Testing
npm run buildpasses. Not exercised in a browser: please test on staging with two tabs of one browser (request the link in tab 1, open it from the email), then once with the link opened in another browser; and sign in through the group wizard and check the top bar.🤖 Generated with Claude Code