Extract StaticAssets hook with a single default live_session

This commit is contained in:
Claudio Ortolina
2025-05-13 21:03:59 +01:00
parent bb6fffca38
commit bb4fce61c7
8 changed files with 33 additions and 50 deletions
@@ -17,13 +17,6 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
@impl true
def mount(_params, _session, socket) do
socket =
if static_changed?(socket) do
put_flash(socket, :warning, gettext("The application has been updated, please reload."))
else
socket
end
{:ok, assign(socket, :nav_section, :records)}
end
@@ -15,13 +15,6 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
@impl true
def mount(%{"id" => record_id}, _session, socket) do
socket =
if static_changed?(socket) do
put_flash(socket, :warning, gettext("The application has been updated, please reload."))
else
socket
end
if connected?(socket) do
Records.subscribe(record_id)
end
@@ -16,13 +16,6 @@ defmodule MusicLibraryWeb.WishlistLive.Index do
@impl true
def mount(_params, _session, socket) do
socket =
if static_changed?(socket) do
put_flash(socket, :warning, gettext("The application has been updated, please reload."))
else
socket
end
current_date = DateTime.utc_now() |> DateTime.to_date()
{:ok,
@@ -14,13 +14,6 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
@impl true
def mount(_params, _session, socket) do
socket =
if static_changed?(socket) do
put_flash(socket, :warning, gettext("The application has been updated, please reload."))
else
socket
end
current_date = DateTime.utc_now() |> DateTime.to_date()
{:ok,