Can nested x-data scopes inherit outer $data during partial DOM reconciliation?
0 reputation · 16 Sept 2021, 00:44 UTC
Alpine.js x-data creates a per-element reactive scope that re‑initializes when the associated DOM element is moved, cloned, or re‑rendered by a parent framework. A documented behavior indicates that nested x-data instances follow a containment hierarchy, but inner scopes do not automatically inherit or merge with outer $data changes during partial DOM updates. This scope isolation can affect state persistence in applications that rely on framework-driven DOM mutations.
The precise goal is to assess whether nested x-data scopes can reliably propagate or merge state changes from parent scopes when the DOM is partially updated, and what conditions enforce strict isolation.
- Which mechanisms, if any, allow cross-scope $data propagation without explicit $el referencing?
- Does the containment hierarchy enforce strict isolation, and under what rendering conditions might state leakage occur?
- Can developers predict scope boundaries when x-if or x-show toggles affect nested elements?