Trying to drop a specific stream from a socket in LV via.
{_, socket} =
pop_in(socket.assigns.streams[filter_string])
{_, socket} =
pop_in(socket.assigns.streams.__configured__[filter_string])
{:noreply, socket}
But get
[error] GenServer #PID<0.1919.0> terminating
** (KeyError) key "test" not found in: %{__changed__: MapSet.new([]), __configured__: %{}, __ref__: 1}
:erlang.map_get("test", %{__changed__: MapSet.new([]), __configured__: %{}, __ref__: 1})
(elixir 1.18.3) lib/map.ex:318: Map.update!/3
(phoenix_live_view 1.0.9) lib/phoenix_component.ex:1447: Phoenix.Component.update/3
(phoenix_live_view 1.0.9) lib/phoenix_live_view/lifecycle.ex:223: anonymous fn/2 in Phoenix.LiveView.Lifecycle.after_render/1
(phoenix_live_view 1.0.9) lib/phoenix_live_view/lifecycle.ex:237: Phoenix.LiveView.Lifecycle.reduce_socket/3
(phoenix_live_view 1.0.9) lib/phoenix_live_view/lifecycle.ex:222: Phoenix.LiveView.Lifecycle.after_render/1
(phoenix_live_view 1.0.9) lib/phoenix_live_view/channel.ex:992: anonymous fn/4 in Phoenix.LiveView.Channel.render_diff/3
(telemetry 1.3.0) /home/dead/Dev/gale/deps/telemetry/src/telemetry.erl:324: :telemetry.span/3
(phoenix_live_view 1.0.9) lib/phoenix_live_view/channel.ex:983: Phoenix.LiveView.Channel.render_diff/3
(phoenix_live_view 1.0.9) lib/phoenix_live_view/channel.ex:819: Phoenix.LiveView.Channel.handle_changed/4
(stdlib 6.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
(stdlib 6.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
(stdlib 6.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-GDKJG9wvY7sfv3iB", event: "event", payload: %{"event" => "delete_filter", "type" => "click", "value" => %{"filter" => "test"}}, ref: "17", join_ref: "4"}
State: %{socket: #Phoenix.LiveView.Socket<id: "phx-GDKJG9wvY7sfv3iB", endpoint: GaleWeb.Endpoint, view: GaleWeb.HomePageLive, parent_pid: nil, root_pid: #PID<0.1919.0>, router: GaleWeb.Router, assigns: %{filters: ["test"], __changed__: %{}, current_user: #Gale.Users.User<__meta__: #Ecto.Schema.Metadata<:loaded, "users">, id: "f08b5683-2009-4b58-8a09-105e2fddb5d0", email: "asdf@asdf.com", confirmed_at: nil, inserted_at: ~U[2025-04-01 01:47:38Z], updated_at: ~U[2025-04-01 01:47:38Z], ...>, flash: %{}, filter_form: %Phoenix.HTML.Form{source: #Ecto.Changeset<action: nil, changes: %{}, errors: [], data: %{}, valid?: true, ...>, impl: Phoenix.HTML.FormData.Ecto.Changeset, id: "form", name: "form", data: %{}, action: nil, hidden: [], params: %{}, errors: [], options: [method: "post"], index: nil}, streams: %{:__changed__ => MapSet.new([]), :__configured__ => %{"test" => [dom_id: #Function<0.13511000/1 in GaleWeb.HomePageLive.handle_event/3>]}, :__ref__ => 1, "test" => %Phoenix.LiveView.LiveStream{name: "test", dom_id: #Function<0.13511000/1 in GaleWeb.HomePageLive.handle_event/3>, ref: "0", inserts: [], deletes: [], reset?: false, consumable?: false}}, live_action: :home}, transport_pid: #PID<0.1908.0>, ...>, components: {%{}, %{}, 1}, topic: "lv:phx-GDKJG9wvY7sfv3iB", serializer: Phoenix.Socket.V2.JSONSerializer, join_ref: "4", redirect_count: 0, upload_names: %{}, upload_pids: %{}}
[
I assume there is a better way?