Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

mobile-development.md

50 lines3.1 KB

1# Mobile development lifecycle
2​
3Ordinary component changes use Metro Fast Refresh. The connection runtime uses
4a stable development-only atom runtime whose writable layer atom receives the
5newly evaluated Effect layer. Its module accepts the update only after installing
6that layer. Existing subscribers observe the new context, and Effect releases the
7previous runtime scope without restarting React Navigation. Production uses an
8ordinary `Atom.runtime` without this hot-update boundary.
9​
10Replacing the atom registry itself disposes its old nodes; replacing the managed
11runtime starts its asynchronous disposal. These modules use normal Metro update
12propagation. The app does not call `DevSettings.reload` during their replacement.
13React can still reset state when its normal Fast Refresh rules require it.
14​
15Do not reset the shared registry to clean up a connection-runtime edit: registry
16reset removes listeners from unedited mounted consumers. Do not self-accept a
17runtime module while leaving importers attached to its old implementation. A
18hot-update boundary must install fresh behavior through the existing reactive
19dependencies. These boundaries do not make every module-level atom family in the
20app hot-swappable; new runtime singletons still need explicit ownership. Editing
21the registry or managed runtime can still rebuild a much larger dependency graph
22than an ordinary component or connection-runtime edit.
23​
24Environment supervisor scopes are children of the connection registry scope.
25The registry's per-environment map supports targeted shutdown, but it cannot be
26the sole owner: a supervisor created after that map's finalizer has run must
27still inherit the closed parent scope. Otherwise interrupted startup or runtime
28replacement can leave a session and WebSocket alive outside the current registry.
29​
30The compact Home list owns its minute-based presentation clock in a focus effect.
31Blur clears the interval without a render-driving focus subscription; focus
32refreshes the clock immediately. Other prop or state changes can still render
33the hidden list. Exact snooze-expiry timers remain active, and the visible iPad
34sidebar keeps its own minute updates.
35​
36Connection and runtime projections are shared per environment. Thread selection
37consumers should read those atoms instead of repeatedly parsing the same socket
38URL or constructing new connection objects during each render.
39​
40The Uniwind dependency patch still recompiles CSS on Metro updates so newly used
41classes are discovered. It fingerprints the generated native stylesheet and
42theme list, then skips development-only global invalidation when that output is
43unchanged. A changed stylesheet or theme list still resets the style caches and
44notifies subscribers. The digest is committed only after initialization succeeds.
45Web and production retain their existing initialization behavior.
46​
47After installing or changing the Uniwind patch, restart Metro once with
48`vp run dev:client:reset` from `apps/mobile`. pnpm gives patched packages new
49filesystem paths, and cached transforms can otherwise retain references to the
50previous package. Ordinary development starts should retain the transform cache.