I’ve set up a minimal reproduction repository: GitHub - tcoopman/bug-send_update: Minimal reproduction of send_update bug?
Have a look a the commits, if this seems a bug to you, I’ll report it.
This commit introduces the send_update that works: minimal working setup · tcoopman/bug-send_update@2c3bd5a · GitHub
This commit introduces the bug: change that breaks send_update · tcoopman/bug-send_update@74756c0 · GitHub
I noticed that before breaking commit (so the liveview without a handle_info
in it), I get warnings in my console:
[debug] HANDLE EVENT
Component: BugWeb.BugComponent
View: BugWeb.BugLive
Event: "trigger"
Parameters: %{"value" => ""}
[debug] Replied in 158µs
[debug] warning: undefined handle_info in BugWeb.BugLive. Unhandled message: {#Reference<0.2535388494.1662582810.76242>, {:phoenix, :send_update, {BugWeb.BugComponent, "Id", %{id: "Id", status: "ok"}}}}
[debug] warning: undefined handle_info in BugWeb.BugLive. Unhandled message: {:DOWN, #Reference<0.2535388494.1662582810.76242>, :process, #PID<0.696.0>, :normal}
But those warnings become an error when the handle_info
is implemented:
[error] GenServer #PID<0.741.0> terminating
** (FunctionClauseError) no function clause matching in BugWeb.BugLive.handle_info/2
(bug 0.1.0) lib/bug_web/live/bug_live.ex:12: BugWeb.BugLive.handle_info({#Reference<0.2535388494.1662582810.77010>, {:phoenix, :send_update, {BugWeb.BugComponent, "Id", %{id: "Id", status: "ok"}}}}, #Phoenix.LiveView.Socket<id: "phx-FyvUXB_5qTrGPAKE", endpoint: BugWeb.Endpoint, view: BugWeb.BugLive, parent_pid: nil, root_pid: #PID<0.741.0>, router: BugWeb.Router, assigns: %{__changed__: %{}, flash: %{}, live_action: :index}, transport_pid: #PID<0.735.0>, ...>)
(phoenix_live_view 0.18.3) lib/phoenix_live_view/channel.ex:260: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.1.1) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.1.1) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {#Reference<0.2535388494.1662582810.77010>, {:phoenix, :send_update, {BugWeb.BugComponent, "Id", %{id: "Id", status: "ok"}}}}
State: %{components: {%{1 => {BugWeb.BugComponent, "Id", %{__changed__: %{}, flash: %{}, id: "Id", myself: %Phoenix.LiveComponent.CID{cid: 1}, status: "ok"}, %{__changed__: %{}, root_view: BugWeb.BugLive}, {46570842166237931649808947786033767038, %{1 => {221396633504767734881948039861660186427, %{3 => {256413836812106541222927451835396884738, %{}}}}}}}}, %{BugWeb.BugComponent => %{"Id" => 1}}, 2}, join_ref: "4", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<id: "phx-FyvUXB_5qTrGPAKE", endpoint: BugWeb.Endpoint, view: BugWeb.BugLive, parent_pid: nil, root_pid: #PID<0.741.0>, router: BugWeb.Router, assigns: %{__changed__: %{}, flash: %{}, live_action: :index}, transport_pid: #PID<0.735.0>, ...>, topic: "lv:phx-FyvUXB_5qTrGPAKE", upload_names: %{}, upload_pids: %{}}
To be clear, the send_update through - the live component is rerendered, but after that the liveview crashes.