1# Mobile development lifecycle
2
3The [connection runtime's HMR boundary](../../apps/mobile/src/lib/hot-swappable-atom-runtime.ts)
4keeps a stable atom runtime and replaces its Effect layer through a writable atom.
5It accepts the update only after installing the new layer. Otherwise importers
6retain the old behavior even though Metro reports a successful refresh.
7
8Do not reset the shared atom registry to refresh a connection-runtime edit. Reset
9removes listeners from mounted consumers that Metro has no reason to rerender.
10When the registry or managed-runtime module itself changes, normal Metro propagation
11disposes its old resources. This boundary does not make arbitrary module-level atom
12families safe to hot-swap. Production uses an ordinary atom runtime.
13
14[Environment supervisor scopes](../../packages/client-runtime/src/connection/registry.ts)
15are children of the registry scope. The per-environment map supports targeted
16shutdown, but a supervisor created after its cleanup runs would escape it. A closed
17parent scope also closes late arrivals, preventing interrupted startup or runtime
18replacement from leaving a WebSocket alive outside the new registry.
19
20Uniwind compiles CSS on Metro updates so newly used classes are discovered. It
21skips global style invalidation only when the generated stylesheet and theme list
22are unchanged. Skipping compilation would lose new classes; invalidating every
23consumer for unchanged output makes an ordinary component edit refresh the whole
24app. The fingerprint is recorded only after initialization succeeds.
25
26The [expo-notifications patch](../../patches/expo-notifications@57.0.15.patch) protects
27`NotificationCenterManager`'s delegates and pending responses with a lock. React runtimes can
28register and remove delegates concurrently during reloads or scene startup. Delivery snapshots
29delegates under the lock and invokes them after releasing it. Pending-response replay removes
30only the responses in its snapshot, preserving responses received during callbacks. Changes to
31this native patch require reinstalling dependencies and rebuilding the iOS app.
32The native modules under `apps/mobile/modules/` are `file:` dependencies, and pnpm
33copies those into its virtual store instead of linking them. Metro bundles the copy,
34so an edit to a module's TypeScript is invisible to a running dev client until
35`vp i` re-syncs it, while Gradle and CocoaPods compile the worktree directory
36directly. A JavaScript change that "has no effect" on device is usually this.