feat: improve filter performance by reducing Ash.read! calls
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon 2026-01-23 14:22:57 +01:00
parent b4657cae23
commit 1d46fd1baf
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
2 changed files with 86 additions and 13 deletions

View file

@ -308,15 +308,9 @@ defmodule MvWeb.Components.MemberFilterComponent do
@impl true
def handle_event("reset_filters", _params, socket) do
# Reset payment filter
if socket.assigns.cycle_status_filter != nil do
send(self(), {:payment_filter_changed, nil})
end
# Reset all boolean filters
Enum.each(socket.assigns.boolean_filters, fn {custom_field_id_str, _value} ->
send(self(), {:boolean_filter_changed, custom_field_id_str, nil})
end)
# Send single message to reset all filters at once (performance optimization)
# This avoids N×2 load_members() calls when resetting multiple filters
send(self(), {:reset_all_filters, nil, %{}})
# Close dropdown after reset
{:noreply, assign(socket, :open, false)}