ReactiveList onPageChange event fired when filter applied
Issue Type: Bug
Platform:
Web
Description:
i attached this event on ReactiveList
onPageChange={() => {
window.scrollTo({ top: 300, behavior: "smooth" });
}}
The onPageChange event is fired not only on pagination change but also on filter apply (in my case checking on MultiList).
is there a way to add an event to the pagination only via reactiveSearch?
Reactivesearch version: 2.6.2
This is an expected behavior because the results change as you update the selection on MultiList, which causes the page change event to get fired, i.e. if you are on Page 3 and you select a new item in MultiList, you will get to Page 1 in the result components.
onPageChange gets fired whenever there is a change in query, which is either triggered via page change (via interaction) or query change from the subscribed components.
Can you explain your use case - exactly when do you want to scroll to top: 300?
The top:300 was just for the example sake.
what I want to do is to smooth scroll to the top of the ReactiveList
okay, but when do you wish to make the page scroll to top? What kind of event should trigger the scrolling?
Should it be when the user manually interacts with the pagination buttons, or at anytime the pagination changes programmatically via query change?
I want it to scroll when the user manually interacts with the pagination buttons.
For now, we will be exposing onClick handlers on pagination buttons to resolve this issue. But going further, v3 should expose the action type as a param with onPageChange to specify the cause of the event trigger. For example:
Action types can be:
QUERY_CHANGE
INTERACTION
cc @divyanshu013
Thank you for your support
Added in v2.6.7 🤘