diff --git a/lib/music_library_web/live/stats_live/index.ex b/lib/music_library_web/live/stats_live/index.ex
index f39d2b04..647700df 100644
--- a/lib/music_library_web/live/stats_live/index.ex
+++ b/lib/music_library_web/live/stats_live/index.ex
@@ -45,29 +45,10 @@ defmodule MusicLibraryWeb.StatsLive.Index do
- <.async_result :let={summary} assign={@collection_summary}>
- <:loading>
-
- <.section>
- <:title>{gettext("Formats")}
-
-
- <.section>
- <:title>{gettext("Types")}
-
-
-
-
- <:failed :let={_reason}>
- 0} class="grid gap-x-5 md:grid-cols-2">
- <.formats_stats collection_count_by_format={summary.collection_count_by_format} />
- <.types_stats collection_count_by_type={summary.collection_count_by_type} />
-
-
+ 0} class="grid gap-x-5 md:grid-cols-2">
+ <.formats_stats collection_count_by_format={@collection_count_by_format} />
+ <.types_stats collection_count_by_type={@collection_count_by_type} />
+
@@ -165,6 +146,8 @@ defmodule MusicLibraryWeb.StatsLive.Index do
collection_count: Collection.count(),
wishlist_count: Wishlist.count(),
scrobble_count: ListeningStats.scrobble_count(),
+ collection_count_by_format: Collection.count_records_by_format(),
+ collection_count_by_type: Collection.count_records_by_type(),
last_updated_uts: nil,
scrobble_activity_mode: "albums",
page_title: gettext("Stats"),
@@ -175,8 +158,6 @@ defmodule MusicLibraryWeb.StatsLive.Index do
{:ok,
%{
collection_summary: %{
- collection_count_by_format: Collection.count_records_by_format(),
- collection_count_by_type: Collection.count_records_by_type(),
records_by_artist: Collection.count_records_by_artist(limit: 20),
records_by_genre: Collection.count_records_by_genre(limit: 20),
records_by_release_year: Collection.count_records_by_release_year(limit: 20)
diff --git a/test/music_library_web/live/stats_live/index_test.exs b/test/music_library_web/live/stats_live/index_test.exs
index e9b7e856..93caa648 100644
--- a/test/music_library_web/live/stats_live/index_test.exs
+++ b/test/music_library_web/live/stats_live/index_test.exs
@@ -36,7 +36,6 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
conn
|> visit("/")
|> assert_has("dd", collection |> length() |> Integer.to_string())
- |> render_async()
collection
|> Enum.frequencies_by(& &1.format)