You’re right, I’ve checked the docs and you should not do that:
Another pitfall of
.leextemplates is related to variables. Due to the scope of variables, LiveView has to disable change tracking whenever variables are used in the template, with the exception of variables introduced by Elixir basiccase,for, and other block constructs. Therefore, you must avoid code like this in your LiveEEx:
<% some_var = @x + @y %>
<%= some_var %>
Instead it’s recommended to use a function:
sum(@x, @y)
So in your case you could do this:
def render(assigns), do: ~L"""
<section id="<%= assigns.x.id %>">
<ul>
<li><%= my_map(@x).foo %></li>
<li><%= my_map(@x).bar %></li>
<li><%= parse_qux(my_map(@x).qux) %></li>
</ul>
</section>
"""
Where my_map is defined like this (or using pattern matching):
def my_map(x), do: x.y.z.my_map






















