Skip to content

Commit

Permalink
get_connect_params/1 can only be called inside mount/3 (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Apr 20, 2024
1 parent b456332 commit b97a9e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/banchan_web/live/offering_live/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,22 @@ defmodule BanchanWeb.OfferingLive.Show do

alias BanchanWeb.StudioLive.Components.OfferingCard

@impl true
def mount(_params, _sess, socket) do
socket =
assign(socket, order_seed: get_connect_params(socket)["order_seed"] || Prime.generate(16))

{:ok, socket}
end

@impl true
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
def handle_params(%{"offering_type" => offering_type} = params, _uri, socket) do
if socket.assigns[:offering] do
Notifications.unsubscribe_from_offering_updates(socket.assigns.offering)
end

socket =
assign_studio_defaults(params, socket, false, true)
|> assign(order_seed: get_connect_params(socket)["order_seed"] || Prime.generate(16))
socket = assign_studio_defaults(params, socket, false, true)

offering =
Offerings.get_offering_by_type!(
Expand Down

0 comments on commit b97a9e6

Please sign in to comment.