Sure I assign it to socket. assign(socket, profiles: fetch_profiles(), user_id: session["user_id"])
Basically when I click on this link I loose all data in assigns. <%= live_patch "New Profile", to: Routes.user_profile_index_path(@socket, :new) %>
This all happens when I used mix phx.gen.live. As I can see from docs assigns don’t change right after I change URL. Phoenix.LiveView — Phoenix LiveView v1.2.5
One more thing I noticed. I don’t have assigns from index.ex in form_component.ex. This is the problem I need to solve. Unfortunately it was not obvious at first glance.
EDIT:
I didn’t look at the index.html.leex. Because I thought code this important would not be hiding in templates. Anyway I need to define it here
<%= live_modal @socket, RoyalWeb.User.ProfileLive.FormComponent,
+ user_id: @user_id,
id: @profile.id || :new,
title: @page_title,
action: @live_action,
profile: @profile,
return_to: Routes.user_profile_index_path(@socket, :index) %>
<% end %>






















