Skip to content

Webview reload appears to log out the Pro user (signed-in state not re-hydrated on reload) #1647

Closed

Description

@mstomar125

Summary

Reloading the webview (right-click → Reload) makes a signed-in Pro user appear signed out — the pill drops to "Sign in". The session is not actually lost (the daemon still holds it; a full app restart auto-resumes), so this is a UI state-hydration bug on reload, not a real sign-out.

Repro

  1. Sign in (Pro) — pill shows signed-in / Synced.
  2. Right-click in the window → Reload (or any webview reload).
  3. Pill flips to signed-out ("Sign in"), even though the daemon session is intact.

Cause

packages/desktop-app/src/lib/stores/pro-sync.svelte.ts — on (re)initialization the store starts at state='auth-required', userEmail=''. The signed-in state is only populated from initial_status.user_email delivered on the pro:tier-detected event. Per the in-code comment, the first pro_subscribe_sync_status invoke races the backend's async init, so on a reload initial_status can be null/empty. When it is, userEmail stays '' and the derived state resolves to auth-required → the UI shows signed-out. The subsequent sync:status stream only pushes on change, so if the daemon doesn't re-emit the current signed-in status on (re)subscribe, the UI never re-hydrates.

Fix

On (re)load, request/deliver a current status snapshot (incl. user_email) from the daemon on subscribe — so the signed-in state re-hydrates deterministically instead of depending on a raced initial_status or a future change event. (Alternatively, have the daemon always emit the current status immediately on pro_subscribe_sync_status.)

Impact

Any accidental or intentional reload looks like a logout — confusing, and makes the app feel like it loses the session when it hasn't.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions