<%= turbo_stream.append "tree-nodes" do %>
  <%= render partial: 'tree_node', object: @node, as: 'node' %>
<% end %>


<% if @node.parent %>
  
  <turbo-stream action="replace" targets="#<%= dom_id(@node.parent) %>">
    <template>
      <%= render partial: 'node', object: @node.parent %>
    </template>
  </turbo-stream>
  

  <turbo-stream action="replace" targets="#<%= dom_id(@node.parent, 'list-title-link') %>">
    <template><%= tree_node_title_link @node.parent %></template> 
  </turbo-stream>

<% else %>

  <turbo-stream action="append" targets="#drawer-structure">
    <template>
      <%= render partial: 'node', object: @node %>
    </template>
  </turbo-stream>

<% end %>
