Hi,
Thank you.
I refactored my page a bit and I am no longer getting the error message.
I needed to have 2 handle_params defined, and both are running every time I click “continue”
The issue now is that my page “1” is not being rendered correctly from page “2” - I am missing parts, it’s not loading correctly.
def handle_params(%{“page” => page}, _, socket) do
Logger.info(“handle params 1”)
page = String.to_integer(page)
case page do
1 ->
socket = assign(socket, page: 1)
{:noreply, push_patch(socket, to: "/portfolio/add-site")}
2 ->
socket = assign(socket, page: 2)
{:noreply, push_patch(socket, to: "/portfolio/add-site")}
end
end
def handle_params(params, _, socket) do
Logger.info(“handle params 2”)
Logger.info(params)
{:noreply, socket}
end
HTML:
<%= if (@page == 2) do %>
<.live_component module={WB.PortfolioWeb.SiteTypeComponent} id=“1” params={@params} changeset={@changeset} page={@page} type={@type} location={@location_input} coords={@coords}/>
<%= else %>
…
<%= live_patch “Continue”, to: Routes.live_path(@socket, WB.PortfolioWeb.AddSiteLive, page: 2), class: “btn-primary-medium” %>
<% end %>
In the component:
<%= live_patch “Site Type & Location”, to: Routes.live_path(@socket, Web.AddSiteLive, page: 1), class: “” %>
Router.ex:
live(“/portfolio/add-site”, AddSiteLive)






















