From 95870aa054593fd6626cab955f7a702b4ce1da1a Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Fri, 24 Jan 2025 11:16:04 +0000 Subject: [PATCH] Add TODOs for consequences of updating records in list views --- .../live/collection_live/index.ex | 4 ++++ lib/music_library_web/live/wishlist_live/index.ex | 4 ++++ priv/gettext/default.pot | 14 +++++++------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/music_library_web/live/collection_live/index.ex b/lib/music_library_web/live/collection_live/index.ex index abae8c61..53f87c25 100644 --- a/lib/music_library_web/live/collection_live/index.ex +++ b/lib/music_library_web/live/collection_live/index.ex @@ -88,6 +88,10 @@ defmodule MusicLibraryWeb.CollectionLive.Index do @impl true def handle_info({MusicLibraryWeb.RecordLive.FormComponent, {:saved, record}}, socket) do + # TODO: when a record is updated, there's no guarantee that 1) it will end + # up in the same position and 2) it would still be visible given current + # filters. Instead of inserting into the stream, we should reload the + # collection with the same params. {:noreply, stream_insert(socket, :records, record)} end diff --git a/lib/music_library_web/live/wishlist_live/index.ex b/lib/music_library_web/live/wishlist_live/index.ex index 983ec8de..72fb198b 100644 --- a/lib/music_library_web/live/wishlist_live/index.ex +++ b/lib/music_library_web/live/wishlist_live/index.ex @@ -88,6 +88,10 @@ defmodule MusicLibraryWeb.WishlistLive.Index do @impl true def handle_info({MusicLibraryWeb.RecordLive.FormComponent, {:saved, record}}, socket) do + # TODO: when a record is updated, there's no guarantee that 1) it will end + # up in the same position and 2) it would still be visible given current + # filters. Instead of inserting into the stream, we should reload the + # wishlist with the same params. {:noreply, stream_insert(socket, :records, record)} end diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index e9f96115..ffc76583 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -59,12 +59,12 @@ msgstr "" msgid "Edit" msgstr "" -#: lib/music_library_web/live/collection_live/index.ex:129 -#: lib/music_library_web/live/collection_live/index.ex:136 +#: lib/music_library_web/live/collection_live/index.ex:133 +#: lib/music_library_web/live/collection_live/index.ex:140 #: lib/music_library_web/live/stats_live/index.ex:53 #: lib/music_library_web/live/stats_live/index.ex:59 -#: lib/music_library_web/live/wishlist_live/index.ex:128 -#: lib/music_library_web/live/wishlist_live/index.ex:135 +#: lib/music_library_web/live/wishlist_live/index.ex:132 +#: lib/music_library_web/live/wishlist_live/index.ex:139 #, elixir-autogen, elixir-format msgid "Error importing record" msgstr "" @@ -188,15 +188,15 @@ msgstr "" msgid "Purchased on" msgstr "" -#: lib/music_library_web/live/collection_live/index.ex:121 +#: lib/music_library_web/live/collection_live/index.ex:125 #: lib/music_library_web/live/stats_live/index.ex:45 -#: lib/music_library_web/live/wishlist_live/index.ex:120 +#: lib/music_library_web/live/wishlist_live/index.ex:124 #, elixir-autogen, elixir-format msgid "Record imported successfully" msgstr "" #: lib/music_library_web/live/record_live/form_component.ex:124 -#: lib/music_library_web/live/wishlist_live/index.ex:148 +#: lib/music_library_web/live/wishlist_live/index.ex:152 #: lib/music_library_web/live/wishlist_live/show.ex:106 #, elixir-autogen, elixir-format msgid "Record updated successfully"