Skip to content

fix: refresh profile after email verification - #27

Open
bluewandd wants to merge 2 commits into
aervxa:mainfrom
bluewandd:pr/lepse-email-verification
Open

fix: refresh profile after email verification#27
bluewandd wants to merge 2 commits into
aervxa:mainfrom
bluewandd:pr/lepse-email-verification

Conversation

@bluewandd

@bluewandd bluewandd commented Sep 2, 2026

Copy link
Copy Markdown

An unverified user can verify in another tab or window while an open Lachesis window keeps the stale profile, so its banner and gates remain visible. The profile query was not refreshed: Lachesis sets TanStack Query's global refetchOnWindowFocus to false because other refetches are manual.

This change opts only the profile query back in with a conditional refetchOnWindowFocus; it stops opting in once emailVerified is true, so verified users make no further focus-triggered profile requests.

Baseline: installed TanStack Query 5.102.8's stock focus listener subscribes to visibilitychange only. A focused harness against that package refetched on hidden-to-visible and did not react to a bare window focus event. Thus the browser tab-return path is covered; a Tauri window regaining native focus while visibility stays visible is not. Separate issue: Tauri native-window focus refresh.

The replacement global focusManager.setEventListener was deliberately removed, along with the login-token query/startup-prefetch guards. This pull request is one file and only addresses the profile refresh.

@bluewandd

bluewandd commented Sep 2, 2026

Copy link
Copy Markdown
Author

Superseded. This PR has been rewritten as a single independent change against current main, and no longer belongs to a sequence or requires any particular merge order.

The earlier branch was based on 7e8c988 and is gone. The new commit is 3 files, +25/-5, and touches only the profile query lifecycle, the focus listener, and the startup prefetch. See the updated description.

@bluewandd
bluewandd force-pushed the pr/lepse-email-verification branch from 260fe99 to 5a576a7 Compare September 6, 2026 07:34
@bluewandd bluewandd changed the title feat: add email verification fix: refresh profile after email verification Sep 6, 2026
@aervxa

aervxa commented Sep 8, 2026

Copy link
Copy Markdown
Owner

tanstack's refetchOnFocus should do this ?

@bluewandd
bluewandd force-pushed the pr/lepse-email-verification branch from 5a576a7 to 383ca37 Compare September 8, 2026 11:45
@bluewandd

Copy link
Copy Markdown
Author

Yes — that's all it needed. It's now just a per-query refetchOnWindowFocus on the profile, conditional so it stops once emailVerified is true. The global refetchOnWindowFocus: false in the query client is why the built-in wasn't firing.

Dropped the global focus listener and the token guards, so this is one file now.

One thing worth flagging: 5.102.8's default focus listener subscribes to visibilitychange only, so returning to a hidden tab is covered but a Tauri window regaining native focus while it stays visible is not. Left that as a separate issue rather than adding anything here.

@aervxa

aervxa commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Correct, but data?.data? is redundant, data?.data.xxx is correct

ps. ur correct, it won't work for an app, and the fix is specified in the respective docs

@bluewandd

Copy link
Copy Markdown
Author

Fixed in 7876963 — dropped the inner ?.. Typecheck passes.

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.

3 participants