Hook derives state from existing React Query caches (useCategories + useTemplate) with zero additional network calls
DB migrations applied manually by user via supabase db push after checkpoint gate
duration
tasks_completed
files_created
files_modified
~35min (including checkpoint wait)
3
1
0
Phase 06 Plan 03: useFirstRunState Hook and DB Schema Push Summary
Derived first-run detection hook reading from React Query cache with loading guard to prevent spurious redirects, plus live DB schema with uniqueness constraints and setup_completed column.
A read-only derived state hook that composes useCategories() and useTemplate() to determine whether the current user is a first-run user (no categories or no template items). Returns { isFirstRun: boolean, loading: boolean }. The loading flag is critical -- callers in Phase 7 must check !loading && isFirstRun before redirecting to prevent false positives while queries are in flight.
DB Schema Push (migrations 006 + 007)
User applied both migrations via supabase db push:
Migration 006: UNIQUE constraints on budgets(user_id, start_date) and categories(user_id, name) with safe deduplication
Migration 007: setup_completed boolean column on profiles with backfill for existing users