Repository navigation
Description
Severity
Critical for v1 ship — App is unusable past the Home screen on real device. Every View renders standalone in snapshot tests, but production navigation never reaches them because RootView's destination closure ignores the route.
Root cause
Packages/SudokuKit/Sources/SudokuUI/Root/RootView.swift:22:
NavigationStackHost(
path: ...,
sidebar: { sidebarPlaceholder },
content: { rootContent },
destination: { _ in EmptyView() } // ← THIS
)When user taps a HomeView mode card → viewModel.path.append(.daily) → NavigationStack tries to render destination(.daily) → returns EmptyView() → user sees blank screen.
Discovery
Issue #34 cleanup confirmed all 7 ViewModelFactory entries were dead. Tracing why: the destination closure never calls them either. The DI/composition pattern envisioned by design.md §How.1 was never wired end-to-end.
Fix
Two coupled changes:
-
Code:
RootView.destinationbecomes a real switch:destination: { route in switch route { case .home: EmptyView() // root content, not pushed case .daily: DailyHubView(viewModel: ...) case .practice: PracticeHubView(viewModel: ...) case .board(let puzzleId): BoardView(viewModel: ...) case .completion(let pid, let secs): CompletionView(viewModel: ...) case .leaderboard(let id): LeaderboardView(viewModel: ...) case .settings: SettingsView(viewModel: ...) } }
Each downstream VM is constructed inline with the same Binding-or-let pattern as HomeViewModel (post HomeView mode cards have shrunken tap targets; Mac sidebar items don't respond #15). Some VMs need protocol-injected deps (PuzzleStore, Persistence, GameCenter, Telemetry) — those need plumbing through
RootView.initor via composition root. -
Spec:
docs/design.md §How.1amends:- Remove references to per-view ViewModelFactory
- Document the actual pattern: inline construction in destination closure + RootView holds dependencies as @Environment or stored properties
- Cross-link issues HomeView mode cards have shrunken tap targets; Mac sidebar items don't respond #15 / AppComposition: all 6 remaining ViewModelFactory entries also appear unused #34 / this issue as the trail
Acceptance
- After fix, tapping any HomeView card on real device (or Xcode preview) renders the corresponding View, not blank
- All 364 tests still green (snapshot tests already instantiate each View standalone — they'll keep passing regardless)
- Mac sidebar (already wired via NavigationLink in PR fix(homeview, sidebar): tap targets + Mac sidebar wiring + throwaway VM #16) still navigates correctly
- design.md §How.1 reflects actual code
Risk
- BoardView / CompletionView need significant deps (PuzzleStore, Persistence, GameCenter, telemetry). RootView currently doesn't own these — they're plumbed via the (almost-empty) AppComposition struct.
- Either bubble deps into RootView's init, OR move them to @Environment-injected, OR rebuild the composition root to support inline construction.
- Likely the cleanest is: RootView.init takes all the protocols it needs and passes them down per-route inside destination switch.
Workflow
Subagent should follow agent-impl-notes-log + PROPOSAL → IMPL given the architecture scope. Submit proposal first; Leader approves; then implement.
Discovery
Surfaced 2026-05-20 during #34 cleanup audit; user picked Option A (amend §How.1) which forced realization that wiring destination closure is part of the same fix.
EOF
Activity
fix(navigation): wire RootView destination + BoardLoaderView async wr…