Skip to main content

Root Layout and Provider Tree

The root layout (app/_layout.tsx) is the absolute entry point of the CommitT application. Before any screen renders, it wraps the entire component tree in a deeply nested provider architecture. Each layer depends on the one above it, and the order cannot be changed without breaking the system.

Provider Nesting Order

The SecurityShield sits above the navigation stack. If a rooted device or jailbreak is detected, the entire app tree below is unmounted. There is no way to navigate around it.

Invisible Root Components

Three invisible components are mounted alongside the navigation stack:
  • HydrationEngine — Runs useHydrationSync() in the background, continuously pulling delta payloads from Convex and feeding them into the Sync Engine.
  • HealOverlay — A recovery UI that appears when the database is being reconstructed. Reads progress from useHealStore.
  • ChaosFab — Development-only floating action button for injecting failures and testing resilience.

Console Hijack

Before any provider mounts, the root layout activates the global Logger polyfill:
This intercepts every console.log, console.warn, and console.error call across the entire app and writes them to persistent daily log files on disk. This is critical for Release builds where logcat access is unavailable.