fix: preserve paid_filter in URL when toggling field visibility
This commit is contained in:
parent
3b038d451d
commit
217ed632fa
1 changed files with 13 additions and 5 deletions
|
|
@ -524,12 +524,20 @@ defmodule MvWeb.MemberLive.Index do
|
||||||
|
|
||||||
# Pushes URL with updated field selection
|
# Pushes URL with updated field selection
|
||||||
defp push_field_selection_url(socket) do
|
defp push_field_selection_url(socket) do
|
||||||
query_params =
|
base_params = %{
|
||||||
build_query_params(socket, %{
|
"sort_field" => field_to_string(socket.assigns.sort_field),
|
||||||
"sort_field" => field_to_string(socket.assigns.sort_field),
|
"sort_order" => Atom.to_string(socket.assigns.sort_order)
|
||||||
"sort_order" => Atom.to_string(socket.assigns.sort_order)
|
}
|
||||||
})
|
|
||||||
|
|
||||||
|
# Include paid_filter if set
|
||||||
|
base_params =
|
||||||
|
case socket.assigns.paid_filter do
|
||||||
|
nil -> base_params
|
||||||
|
:paid -> Map.put(base_params, "paid_filter", "paid")
|
||||||
|
:not_paid -> Map.put(base_params, "paid_filter", "not_paid")
|
||||||
|
end
|
||||||
|
|
||||||
|
query_params = build_query_params(socket, base_params)
|
||||||
new_path = ~p"/members?#{query_params}"
|
new_path = ~p"/members?#{query_params}"
|
||||||
|
|
||||||
push_patch(socket, to: new_path, replace: true)
|
push_patch(socket, to: new_path, replace: true)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue