# Solid Reactivity Map ## Purpose Define the Solid reactive model contracts the Motion adapter can safely rely on. ## Docs Contract - `createSignal` provides accessor/setter state. Accessor reads inside tracked scopes subscribe dependents. - `createEffect` tracks reads and reruns on dependency changes. - `createRenderEffect` runs in render timing and is earlier than `createEffect`. - `createRoot` creates an owner boundary with explicit disposal. - `onCleanup` teardown is owner-scoped and called on disposal or scope rerun. - `batch` coalesces update propagation. - `untrack` reads without subscription. ## Source Confirmation From Solid reactive internals (`packages/solid/src/reactive/signal.ts`): - Signals store observers and observer slots. - Computations store sources and source slots. - Owners hold `owned` and `cleanups` trees. - `onCleanup` pushes cleanup callbacks to current owner. - `cleanNode` recursively disposes descendants and invokes cleanups. - `batch` delegates to update queue (`runUpdates`). - `untrack` temporarily clears listener tracking. ## Adapter Implications - Motion prop observation must happen in tracked effects, not in component setup. - Never depend on private internals (owner tree shape, queue implementation). - Use public primitives only: - tracking: `createEffect` and `createRenderEffect` - lifecycle: `onMount`, `onCleanup`, `createRoot` - control: `batch`, `untrack` ## Safe To Rely On - Accessor tracking semantics. - Owner-based cleanup cascade. - `batch` update coalescing behavior. - `untrack` subscription suppression. ## Must Stay Behind Adapter - Any assumptions about scheduler queue internals. - Any assumptions about computation ordering beyond documented guarantees. ## Open Risks - Solid 2 may adjust scheduling and owner internals. - Adapter must isolate timing semantics from upstream internal churn.