Field Home Screen (Mobile)
The field-user home screen (apps/mobile/src/app/(field)/index.tsx) is the first
thing a field worker sees after signing on. It surfaces their day at a glance:
today’s prestarts and their open dockets, kept live without a manual refresh.
Today’s Prestarts
The top section lists every prestart the field user signed on to today. Each
row deep-links straight to the corresponding Prestart screen
(/prestart/[prestartId]).
- Data comes from
getFieldTodayPrestarts(orgId, projectId)→GET /v1/orgs/{orgId}/projects/{projectId}/prestarts/mine/today. “Me” is resolved from the session; “today” is computed in the project timezone so it matches each sign-on’ssigned_for_date. - Sign-ons that aren’t attached to a prestart (standalone QR/office sign-ons) have no prestart screen to open, so they’re summarised in a muted line — “Also signed on at N location(s) with no prestart” — rather than listed.
Active Dockets — open dockets, active one highlighted
Below the prestarts, the Active Dockets section lists all open (non-confirmed) dockets for the worker — draft, submitted, and reviewed.
- The list is fetched with
listDockets(..., { worker_id, open: true }). Theopenfilter excludes onlyconfirmeddockets. - The currently active docket — one whose shift date is today and whose
status is still
draft— is highlighted with the green “live” treatment. A worker can have more than one active docket in a day (e.g. two suppliers); all qualifying rows are highlighted. If an active docket has a start time but no end time, its row shows a live elapsed-time counter. - Submitted/reviewed dockets remain visible and tappable but are not highlighted — tapping one opens the docket in its correct read-only state.
No manual refresh after sign-on
Signing on updates the home screen automatically — there is no client-side polling (per the platform’s real-time doctrine). Two mechanisms cover it:
- Mutation invalidation — the start-shift / sign-on mutation invalidates the
home queries (
field-home-dockets,field-home-today-prestarts) on success, so the screen is fresh the moment the worker returns to it. - WebSocket invalidation — the mobile WS provider’s
INVALIDATION_MAProutesdocketsandprestart_sign_onschange events to the same home query keys, so a sign-on or docket change from any device (or the QR flow) refreshes the home screen live.