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:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user