solid-motion-experiments docs research solid-control-flow-presence-map.md
1.9 kB · 42 lines
Markdown
at main

Solid Control Flow Presence Map #

Purpose #

Define how Solid control-flow disposal interacts with Motion exit retention.

Core Problem #

When <Show> or <For> removes a child, logical removal can dispose owner state immediately. Exit animations require physical DOM retention beyond logical removal.

Required Distinction #

  • Logical presence: key still included by parent control-flow conditions/data.
  • Physical presence: node/owner kept alive long enough to finish exit.

Minimal Retention Algorithm #

  1. Render keyed present set.
  2. Diff previous keys to current keys.
  3. Move missing keys to exiting registry.
  4. Keep exiting nodes physically present.
  5. Mark exiting context as not-present.
  6. Remove only on exit-complete signal.
  7. Ensure dispose runs exactly once.

Adapter Implications #

  • The current prototype keeps retention local to AnimatePresence rather than treating createRoot by itself as the presence strategy.
  • Presence implementation must explicitly retain and release the disappearing direct child record.
  • Nested exits still require completion aggregation before parent removal, which is why PresenceChild sits between AnimatePresence and motion descendants.

Required Prototype Checks #

  • <Show> close keeps child alive until fake exit complete.
  • Single-slot AnimatePresence keeps one disappearing direct child alive until exit completes.
  • <For> keyed removal remains later work beyond the current prototype scope.
  • Rapid remove/readd does not duplicate nodes.
  • Cleanup and deregistration each occur once.

Safe To Rely On #

  • Owner cleanup cascade exists.
  • Control-flow removes logical children when conditions/data change.

Must Stay Experimental In Milestone 0 #

  • Keyed-list presence orchestration.
  • Full AnimatePresence parity semantics beyond the current single-slot sync and wait modes.