Skip to content

fix(data): queries paused as "offline" on a cold load leave screens showing empty states #883

Closed as not planned

Description

@thinkclay

Found while reskinning My applications (#826).

What happens

Open /jobs/applications by URL, signed in, with applications in the database. The screen renders "Nothing here yet".

Probed from the page, the query is not loading and not errored:

{ status: "pending", fetchStatus: "paused", isError: false, data: undefined }

fetchStatus: "paused" is React Query's offline state: networkMode defaults to "online", so when onlineManager reports offline the query never attempts a fetch and never errors. It stays that way indefinitely — dispatching online and focus events did not resume it.

Navigating to the same screen from inside the app (clicking Applications in the drawer) fetches normally and renders all seven applications. Only the cold load is affected.

Why it matters

A paused query is indistinguishable from an empty result at the component level, so every screen that renders "you have none of these" when data is empty will lie about it. On this screen a worker with an offer waiting was told they had never applied to anything.

#826 adds an explicit error branch to this screen, but that does not help: a paused query is not an error. The fix has to be in the data layer.

What is ruled out

  • navigator.onLine is true in the page.
  • The NetInfo-backed onlineManager.setEventListener lives in packages/scf-core/provider/react-query/QueryProvider.native.tsx, which Metro resolves for native only. The web provider (QueryProvider.tsx) installs no online manager, so React Query's default web behaviour should apply.
  • Not every query is affected in the same load: on the same page, auth/roles, notifications/unread-count and prerequisites/check returned 200 while the applications query sat paused.
  • Not an auth failure. Earlier loads produced real 401s from the same endpoint inside the auth window; the paused state is separate, and a manual fetch with the same stored token returns 200 from the same page.

Worth checking

  • Whether anything pulls QueryProvider.native into the web bundle, which would install the NetInfo listener; NetInfo's web implementation does a reachability probe that can report isConnected: false where outbound requests are restricted.
  • Whether networkMode: "always" is the right default for this app, given every request goes to a local or first-party origin.
  • Whether the same pause happens in a normal browser or only in an embedded one — the observation above is from the in-app browser pane.

Acceptance

  • Cold-loading /jobs/applications signed in shows the applications, not the empty state
  • A query that cannot reach the network reports an error state rather than sitting silently pending, so screens can say so
  • Whatever sets the online state is the same module on web and native, and is covered by a test

Activity

  1. added
    bug
    on Sep 23, 2026
  2. thinkclay commented on Sep 23, 2026

    @thinkclay
    ContributorAuthor

    Sharper evidence, and it may be the same root cause seen from the other end.

    Instrumenting window.fetch in the running app, every SDK request goes out with the anon apikey and no Authorization header at all, while the drawer shows the signed-in user and their email:

    { u: '…/v1/profiles/widgets/general-info',  auth: '(none)', apikey: 'eyJhbGciOi…' }
    { u: '…/v1/profiles/completion/status',     auth: '(none)', apikey: 'eyJhbGciOi…' }
    { u: '…/v1/employers/<org id>',             auth: '(none)', apikey: 'eyJhbGciOi…' }
    { u: '…/v1/applications?limit=50',          auth: '(none)', apikey: 'eyJhbGciOi…' }
    

    A fetch from the same page, with the access token read straight out of localStorage, returns 200 from those same endpoints. So the credential is present and valid; the data layer is not using it.

    That points at ScaffaldJobsSdkProviderFromSession (packages/scf-core/utils/jobs-sdk-context.tsx): its config falls back to { baseUrl, anonKey } whenever session?.access_token is empty, and the client keeps that config. The provider's own comment notes that the inner provider shadows the outer ScaffaldProviderFromSession, which is the shape of a bug where one of the two never sees the session.

    Why it matters more than the paused-query symptom: in this state every SDK-backed screen renders as if signed out — Home shows 0% profile strength and "we couldn't read your sections", My applications shows "nothing here yet" with seven live applications, the employer profile shows "this employer is no longer listed". Nothing says the session is the problem.

    Observed for the whole of a session after a dev-server restart; earlier in the same session, before that restart, the same screens sent the token and rendered. So it is a state the app gets into rather than a permanent condition, which is consistent with the paused queries reported above.

    Worth adding to the acceptance

    • A signed-in session reaches the SDK client, and there is a test that fails if it does not
    • When the client has no user credential, a screen that needs one says so rather than rendering its empty state
  3. thinkclay commented on Sep 23, 2026

    @thinkclay
    ContributorAuthor

    Closing this — I was wrong, and the two comments above are both artefacts of how I was signing in, not app behaviour.

    Re-tested with a clean browser context and a session minted at page-open time (Playwright, addInitScript, the same flow scripts/audit/sweep-routes.mjs uses). Every screen loads on a cold navigation:

    • /jobs/applications renders all seven applications, grouped by stage
    • /employers/<id> renders the employer and their four open roles
    • SDK requests carry the Authorization header

    What I had actually been doing was pasting a freshly minted session into localStorage of an already-booted page, repeatedly, over several hours. Each mint invalidates the previous refresh token, so supabase-js would try to refresh with a token the server had already rotated, fail, and drop the session — while a cached profile query kept showing the user's email in the drawer. From there the SDK provider correctly built an anonymous client, and the screens correctly rendered their signed-out paths. The paused fetch status in the first comment is the same story from earlier in that sequence.

    So: no queries are stuck, and the session does reach the SDK client. Apologies for the noise.

    What is worth keeping from this:

    • feat(redesign): worker My applications reskinned — rows grouped by stage, one status vocabulary #826 added an explicit error branch to the applications list so a failed request no longer renders as "you have no applications". That stands on its own merit and is already merged.
    • The code comments in ApplicationsList and ProfileStrengthSection that cite this issue are now wrong and I will correct them.
    • The real lesson is a verification one: to check a signed-in screen, open a fresh context and inject the session before the page boots. Re-injecting into a live page produces a convincing but entirely false picture of the app being broken.
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

    Frontendbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions