fix: add alert_changed handlers to critical LiveViews

Proactively add catch-all handlers to device index/show pages to
prevent FunctionClauseError when StatusTitleComponent broadcasts
alert changes. These are the most frequently open pages where users
would encounter the crash.
This commit is contained in:
Graham McIntire 2026-03-10 14:12:29 -05:00
parent 48b6f390a8
commit bbb5f886ec
No known key found for this signature in database
2 changed files with 12 additions and 0 deletions

View file

@ -276,6 +276,12 @@ defmodule ToweropsWeb.DeviceLive.Index do
{:noreply, reload_device_stream(socket)}
end
# Handled by StatusTitleComponent in layout - ignore to prevent crashes
@impl true
def handle_info({:alert_changed, _org_id}, socket) do
{:noreply, socket}
end
defp tick_interval_ms do
if Application.get_env(:towerops, :env) == :test, do: :infinity, else: to_timeout(second: 15)
end

View file

@ -244,6 +244,12 @@ defmodule ToweropsWeb.DeviceLive.Show do
{:noreply, assign(socket, :show_check_form, false)}
end
# Handled by StatusTitleComponent in layout - ignore to prevent crashes
@impl true
def handle_info({:alert_changed, _org_id}, socket) do
{:noreply, socket}
end
# Private functions
defp maybe_subscribe_and_schedule_refresh(socket, device_id) do