Skip to content

fix(profile): every profile editor loads empty — first-load reads 401 and are never retried #579

Closed

Description

@thinkclay

Every profile screen fires its API reads before the Supabase access token is usable. The requests 401, and nothing retries them once the session refreshes, so the editors render permanently empty even though the data exists server-side.

Evidence

Single load of /profile/resume (signed in, seeded user [email protected]):

GET /v1/profiles/general            -> 401
GET /v1/profiles/employment         -> 401
GET /v1/profiles/slug/history       -> 401
GET /v1/profiles/import/data        -> 401
GET /v1/resume/has-uploaded         -> 401
GET /v1/profiles/widgets/general-info -> 401

Only prerequisites/check, auth/roles and notifications/unread-count were retried after the refresh. The rest stayed failed for the life of the page.

The same endpoint with the same session, called by hand from the page:

{"first_name":"Zach","last_name":"Servideo","email":"[email protected]",
 "phone":"+1 (424) 280-2876",
 "address":{"street":"10 Central Street","city":"Ipswich","state":"MA","zip":"01938"}}

The rendered form at that moment:

[{"ph":"First name","v":""},{"ph":"Last name","v":""},{"ph":"Phone number","v":""},
 {"ph":"Email address","v":""},{"ph":"Street address","v":""},{"ph":"City","v":""}]

The same load also issued 9 POST /auth/v1/token?grant_type=refresh_token for 20 API calls — there is no single-flight around the refresh.

Root cause

Two independent gaps:

  1. packages/scf-core/utils/jobs-sdk-context.tsx:54 — the recovery invalidation only fires on the isLoading true→false transition (wasLoadingRef). A token that expires while the tab is open never triggers it.
  2. packages/scf-core/utils/jobs-sdk-context.tsx:59 — the sdkQueryKeyPrefixes allow-list has 10 entries, but scf-core registers 30+ query-key roots. Missing: resume, idVerification, user-profiles, communities, workLogs, connections, follows, tasks, punchlists, scheduling, analytics, personality-assessment, office, workers, map, inquiries, ccpa, oauth, and ['scaffald','skills',…] (only second values in the list match, and skills is not one).
  3. packages/scf-core/provider/react-query/QueryProvider.tsx:12 — retry: 2 retries a 401 twice against the same stale client, burning the retry budget before the refresh lands.

Acceptance

  • A 401 from the SDK triggers exactly one token refresh (single-flight) and one retry with the new token.
  • Query invalidation fires on every session.access_token change, not only the first load.
  • The prefix allow-list is removed in favour of invalidating all SDK-backed queries (or is derived from a single exported registry so it cannot drift).
  • Reloading /profile/resume with an expired token populates General Information, Employment Preferences, and the vanity-URL field on the first render, with zero 401s in the network log.
  • A regression test asserts no more than one refresh POST per page load.

Activity

  1. added
    bug
    priority: urgent
    on Aug 12, 2026
  2. thinkclay commented on Aug 12, 2026

    @thinkclay
    ContributorAuthor

    Part of the profile-building audit rollup: #594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrontendUXbugpriority: urgenttype: frontend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions