feat: improve filter performance by reducing Ash.read! calls
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
b4657cae23
commit
1d46fd1baf
2 changed files with 86 additions and 13 deletions
|
|
@ -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)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue