From a05d6c5059c0ed9465b92f8d1238fe015e089044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 1 Nov 2023 21:45:19 +0100 Subject: [PATCH] Only subscribe if connected --- lib/livebook_web/live/hub/edit_live.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/livebook_web/live/hub/edit_live.ex b/lib/livebook_web/live/hub/edit_live.ex index caaaa1f17..5de339307 100644 --- a/lib/livebook_web/live/hub/edit_live.ex +++ b/lib/livebook_web/live/hub/edit_live.ex @@ -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