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:
parent
48b6f390a8
commit
bbb5f886ec
2 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue