Skip to content

perf: add missing loading.tsx skeletons for data-heavy routes #64

@macwilling

Description

@macwilling

Problem

Several routes have no loading.tsx, so navigating to them shows a blank page while the server fetches data. Next.js streams loading.tsx instantly — without it, users wait in silence.

Missing skeletons:

Route Notes
/reports 5 parallel Supabase queries; filter "Apply" button has no disabled/pending state either
/settings Multiple DB reads for tenant settings
/invoices/[invoiceId] Invoice detail + payments + line items
/invoices/new Invoice builder page
/clients/[clientId] Client detail page
/clients/new New client form page
/clients/[clientId]/edit Edit client form page
/tasks/new New task form page
/portal/[tenantSlug]/(protected) Portal task list
/portal/[tenantSlug]/(protected)/tasks/[taskId] Portal task detail

Also: The Reports page "Apply" button (app/(admin)/reports/page.tsx:213) is a plain <button> with no disabled state or loading indicator. When a user clicks it, the page re-fetches with no feedback.

Fix

Add a loading.tsx per missing route that structurally mirrors the real page with animate-pulse skeleton blocks. Follow the existing pattern in app/(admin)/tasks/loading.tsx and app/(admin)/tasks/[taskKey]/loading.tsx.

For the Reports filter button, extract to a small client component so it can be disabled during navigation using useRouter + useTransition or the next/navigation pending state.

Acceptance criteria

  • All 10 routes above have a loading.tsx that mirrors page structure
  • Reports filter "Apply" has a loading/disabled state
  • All skeletons use animate-pulse and match the design system (muted backgrounds)
  • npm run build passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsize:MMedium effort

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions