# TV Compose UI Integration Pitfall: New Composables Without NavHost Wiring

## The Bug

You built 33 new Compose UI files (FocusRegistry, UnifiedSidebar, PremiumContentCard, etc.). They all compile clean (`BUILD SUCCESSFUL`, zero errors). But the app looks **identical** to the previous build. Nothing changed visually.

## Root Cause

Creating new `@Composable` files on disk does NOT wire them into the running app. The NavHost and screen composables still point at the OLD composables (`NetflixHomeScreen`, `NetflixSideNavigation`, `NavigationRailWrapper`).

## Integration Checklist

After building new UI components for an Android TV Compose app, verify:

1. **NavHost wiring** — Open `UnspooledNavHost.kt` (or equivalent). The `composable(route = Screen.Home.route)` block must call the NEW home screen, not the old one.

2. **Sidebar wiring** — If you built a new sidebar (`UnifiedChromeScaffold`), every screen that embeds a sidebar must be updated:
   - `CatalogBrowserScreen` (shared by MoviesScreen, TvShowsScreen, MyListScreen)
   - Any standalone screens with their own sidebar calls (Search, Settings)
   
3. **Card wiring** — If you built new card composables (`PremiumContentCard`, `TvSidePanel`), update every screen that renders content cards:
   - `CatalogRowSection` in CatalogBrowserScreen
   - `HomeRowSection` in the home screen
   - Detail screen cast sections

4. **Deprecation consistency** — If you deprecated old utilities (`DpadThrottleModifier`, `DpadFastScrollModifier`, `DpadKeyEvents`), verify nothing still imports them. Deprecated files should be no-ops or redirects, not deleted (to avoid breaking other files that might reference them).

## Integration Steps (Example)

### 1. NavHost Switch
```kotlin
// Old: import com.unspooled.app.ui.screens.home.NetflixHomeScreen
import com.unspooled.app.ui.screens.home.UnspooledHomeScreen

// Old: NetflixHomeScreen(navController = navController)
UnspooledHomeScreen(navController = navController)
```

### 2. Shared Browser Screen Switch
```kotlin
// Old: NavigationRailWrapper(navController, selectedRoute, sidebarItems, circularItems) { content }
UnifiedChromeScaffold(
    items = sidebarItems,       // List<SidebarItem> not UnspooledSidebarItem
    selectedRoute = selectedRoute,
    onNavigate = { route -> sidebarNavigate(navController, route) },
) { content }
```

### 3. Build Verification
```bash
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew :app:assembleDebug
```
- Read output carefully: `compileDebugKotlin` must show no errors
- Check `mergeProjectDexDebug` and `packageDebug` pass
- Verify APK exists at `app/build/outputs/apk/debug/app-debug.apk`

## Why This Happens

- Kotlin files are compiled independently — a file existing on disk doesn't mean it's referenced anywhere
- Gradle/KSP only checks that imports resolve and types match — it doesn't check that you replaced old components
- No static analysis warns "you have two home screen implementations, only one is wired"
- The old composables still compile and run fine, just with the old UI

## Prevention

After every batch of new UI files:
1. `git status` — count new files vs modified files. If only new files (all `??` or `A`), something is probably not wired.
2. Search for old component names in NavHost and shared screens:
```bash
grep -r "NetflixHomeScreen\|NetflixSideNavigation\|NavigationRailWrapper" app/src/main/java/
```
3. If results exist, you haven't finished integration.
