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:
parent
a52f5a8644
commit
48b6f390a8
1 changed files with 6 additions and 0 deletions
|
|
@ -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)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue