Only subscribe if connected

This commit is contained in:
José Valim 2023-11-01 21:45:19 +01:00
parent ec90333a00
commit a05d6c5059

View file

@ -9,7 +9,9 @@ defmodule LivebookWeb.Hub.EditLive do
@impl true
def mount(_params, _session, socket) do
Hubs.subscribe([:connection])
if connected?(socket) do
Hubs.subscribe([:connection])
end
{:ok, assign(socket, hub: nil, type: nil, page_title: "Hub - Livebook", params: %{})}
end