DJE-043
Error
Template
Missing dj-root on root element
Error message
LiveView updates not applied — page appears static
The root element of a LiveView template must have the dj-root attribute. Without it, djust's client-side JavaScript cannot find the target element for DOM patching, and updates received over WebSocket will not be applied to the page.
liveview
setup
template
Affected versions: >=0.2.0
Solution
Before (problematic)
<!-- counter.html -->
<div>
<h1>Count: {{ count }}</h1>
<button dj-click="increment">+1</button>
</div>
After (fixed)
<!-- counter.html -->
<div dj-root>
<h1>Count: {{ count }}</h1>
<button dj-click="increment">+1</button>
</div>