Render_existing equivalent for LiveViews?

I was using render_existing/3 in the root/app layout to dynamically add page specific actions to a navbar like this.

# app.html.heex
<%= render_existing view_module(@conn), Path.basename(view_template(@conn), ".html") <> "_actions.html", assigns %>

Is it possible to achieve some similar within the live layout with LiveView 0.17?

I’m not completely contempt with this solution. Not sure if there is a better way to call this function.

<%= if function_exported?(@socket.view, :actions, 1) do %>
  <%= @socket.view.actions(assigns) %>
<% end %>
1 Like

I like your solution! :+1: from me.