fix: handle alert_changed messages in AgentLive.Index

The StatusTitleComponent (rendered in authenticated layout) subscribes
to organization:*:alerts PubSub topic. Since LiveComponents run in the
parent process, both the component and parent LiveView receive these
messages.

Added catch-all handler to prevent FunctionClauseError when alert
changes broadcast. The component already handles the message properly.
This commit is contained in:
Graham McIntire 2026-03-10 14:10:10 -05:00
parent a52f5a8644
commit 48b6f390a8
No known key found for this signature in database

View file

@ -398,6 +398,12 @@ defmodule ToweropsWeb.AgentLive.Index do
{:noreply, maybe_update_agent(socket, agent_token_id, organization_id)}
end
# Handled by StatusTitleComponent in layout - ignore to prevent crashes
@impl true
def handle_info({:alert_changed, _org_id}, socket) do
{:noreply, socket}
end
@impl true
def handle_info({:agents_stale, _stale_agents}, socket) do
{:noreply, reload_agent_data(socket)}