Fix record picker search results clearing on add

The update/2 callback unconditionally reset the query and results to empty
on every parent re-render. Changed to assign_new/3 so search state persists
when the parent updates the record set after adding a record.
This commit is contained in:
Claudio Ortolina
2026-05-09 20:11:51 +01:00
parent 5cbd988b46
commit b557fe3eea
@@ -140,9 +140,9 @@ defmodule MusicLibraryWeb.RecordSetLive.RecordPicker do
{:ok, {:ok,
socket socket
|> assign(assigns) |> assign(assigns)
|> assign(:query, "") |> assign_new(:query, fn -> "" end)
|> assign(:collected_results, []) |> assign_new(:collected_results, fn -> [] end)
|> assign(:wishlisted_results, []) |> assign_new(:wishlisted_results, fn -> [] end)
|> assign(:existing_record_ids, existing_record_ids)} |> assign(:existing_record_ids, existing_record_ids)}
end end