Skip to content

Commit b97a9e6

Browse files
authored
get_connect_params/1 can only be called inside mount/3 (#805)
1 parent b456332 commit b97a9e6

File tree

1 file changed

+9
-3
lines changed
  • lib/banchan_web/live/offering_live

1 file changed

+9
-3
lines changed

lib/banchan_web/live/offering_live/show.ex

+9-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,22 @@ defmodule BanchanWeb.OfferingLive.Show do
3131

3232
alias BanchanWeb.StudioLive.Components.OfferingCard
3333

34+
@impl true
35+
def mount(_params, _sess, socket) do
36+
socket =
37+
assign(socket, order_seed: get_connect_params(socket)["order_seed"] || Prime.generate(16))
38+
39+
{:ok, socket}
40+
end
41+
3442
@impl true
3543
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
3644
def handle_params(%{"offering_type" => offering_type} = params, _uri, socket) do
3745
if socket.assigns[:offering] do
3846
Notifications.unsubscribe_from_offering_updates(socket.assigns.offering)
3947
end
4048

41-
socket =
42-
assign_studio_defaults(params, socket, false, true)
43-
|> assign(order_seed: get_connect_params(socket)["order_seed"] || Prime.generate(16))
49+
socket = assign_studio_defaults(params, socket, false, true)
4450

4551
offering =
4652
Offerings.get_offering_by_type!(

0 commit comments

Comments
 (0)