diff --git a/explorer/lib/explorer_web/live/pages/batch/index.ex b/explorer/lib/explorer_web/live/pages/batch/index.ex index 275eac729..df5b6390a 100644 --- a/explorer/lib/explorer_web/live/pages/batch/index.ex +++ b/explorer/lib/explorer_web/live/pages/batch/index.ex @@ -2,6 +2,21 @@ defmodule ExplorerWeb.Batch.Index do require Logger use ExplorerWeb, :live_view + defp set_empty_values(socket) do + Logger.info("Setting empty values") + + socket + |> assign( + merkle_root: :empty, + current_batch: :empty, + newBatchInfo: :empty, + batchWasResponded: :empty, + proof_hashes: :empty, + proofs: :empty, + eth_usd_price: :empty + ) + end + @impl true def mount(%{"merkle_root" => merkle_root}, _, socket) do if connected?(socket), do: Phoenix.PubSub.subscribe(Explorer.PubSub, "update_views") @@ -38,16 +53,9 @@ defmodule ExplorerWeb.Batch.Index do rescue _ -> {:ok, - socket - |> assign( - merkle_root: :empty, - current_batch: :empty, - newBatchInfo: :empty, - batchWasResponded: :empty, - proof_hashes: :empty, - proofs: :empty, - eth_usd_price: :empty - )} + set_empty_values(socket) + |> put_flash(:error, "Something went wrong, please try again later.") + } end @impl true