Skip to content

Commit

Permalink
fix: sorting incorrectly after searching (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Zhu1 authored Jun 22, 2023
1 parent cc5a664 commit 019979c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/sn_filterable/filterable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def filter(params:, items: where(nil), default_sort: nil, pagination_enabled: tr
filter_params = filter_params(params)
sort_params = sort_params(params)
other_params = other_params(params, items)

items = perform_filter(items, filter_params)
items, sort_name, reverse_order = perform_sort(items, sort_params, default_sort)
items = perform_filter(items, filter_params)
items = items.page(other_params[:page]).per(other_params[:per]) if pagination_enabled

Filtered.new(self, items, generate_url_queries(filter_params, sort_params, other_params), sort_name, reverse_order)
Expand Down

0 comments on commit 019979c

Please sign in to comment.