3.5 KiB
phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics
| phase | plan | subsystem | tags | dependency_graph | tech_stack | key_files | decisions | metrics | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 07-setup-wizard | 02 | frontend/setup-wizard |
|
|
|
|
|
|
Phase 07 Plan 02: Setup Wizard Completion and Routing Summary
ReviewStep with grouped read-only summary, wizard completion logic (category + template item creation with duplicate handling), skip flow, /setup route registration, and first-run redirect from dashboard.
Commits
| Task | Commit | Description |
|---|---|---|
| 1 | 396d342 |
ReviewStep component and wizard completion/skip logic |
| 2 | 6b75f14 |
Register /setup route and add first-run redirect |
What Was Built
-
ReviewStep - Read-only summary component showing income, grouped checked items by category type, total expenses, and remaining balance. Uses Intl.NumberFormat for currency formatting. Remaining is colored green (text-on-budget) when positive, red (text-destructive) when negative.
-
Wizard Completion Logic - handleComplete creates one category per needed type (handles 23505 duplicate constraint), creates template items for all checked presets, marks profiles.setup_completed=true, clears localStorage wizard state, invalidates React Query cache, shows toast, and redirects to dashboard.
-
Skip Flow - handleSkipSetup clears localStorage, marks setup_completed=true without creating any data, and redirects to dashboard.
-
Double-submit Prevention -
completingstate disables all buttons during API calls (T-07-04 mitigation). -
/setup Route - Registered in App.tsx as a protected standalone page (inside ProtectedRoute, outside AppLayout). Unauthenticated users are redirected to /login (T-07-06 mitigation).
-
First-run Redirect - DashboardPage uses useFirstRunState to detect users with no categories/template items and redirects them to /setup. Shows DashboardSkeleton during loading.
-
Redirect Loop Prevention - Query invalidation for ["categories"] and ["template-items"] after completion ensures useFirstRunState reads fresh data showing isFirstRun=false (T-07-07 mitigation).
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] Fixed React hooks rule violation in DashboardPage
- Found during: Task 2
- Issue: Plan instructed placing early returns before useMonthParam/useBudgets calls, which violates React rules of hooks (hooks cannot be called conditionally)
- Fix: Moved all hook calls (useMonthParam, useBudgets, useMemo) above the early return statements
- Files modified: src/pages/DashboardPage.tsx
- Commit:
6b75f14
Known Stubs
None - all stubs from Plan 01 have been resolved.