Mobile development lifecycle#
Hot reload and native module traps#
- HMR boundary. The connection runtime HMR wrapper swaps the Effect layer through a writable atom rather than resetting the shared atom registry; resetting the registry drops listeners on mounted consumers that Metro will not rerender.
- Registry-scoped supervisors. Environment supervisor scopes are children of the registry scope so interrupted startup or runtime replacement closes late arrivals instead of leaking sockets.
- Native module
file:copies. Modules underapps/mobile/modules/arefile:dependencies that pnpm copies into its virtual store. Gradle and CocoaPods compile the worktree directly, but Metro bundles the pnpm copy—runvp iafter editing a local module's TypeScript or changes will not appear on device.
Measuring renders#
render-counter.ts loads only when
__DEV__ and EXPO_PUBLIC_T3_RENDER_COUNTER=1 (stripped from release builds).
measure-renders.mts drives measurements through
Metro's Hermes inspector proxy (works on iOS and Android without simctl or adb). Pass the LAN
URL Metro advertises as --metro:
EXPO_PUBLIC_T3_RENDER_COUNTER=1 vp run dev:client # in apps/mobile, then pair the app
node apps/server/src/bin.ts auth session issue --base-dir <base-dir> --token-only
node apps/mobile/scripts/measure-renders.mts --server <server-origin> --token <token> \
--metro http://<metro-lan-host>:8081 --project-root <scratch-dir>
Compare before and after on the same base and device using the median of three runs.
React Compiler#
Expo enables the compiler through experiments.reactCompiler in app.config.ts (not
babel.config.js), and release builds ship unmemoized bailouts silently (panicThreshold: "NONE").
reactCompilerCoverage.test.ts enforces
compilation across source files and fails on new bailouts or stale entries in KNOWN_BAILOUTS. When
fixing a listed file, remove its entry and manual useMemo/useCallback/memo in the same change
(see Web UI for common rewrites).