Legacy table - default selected page

I have a paginated (not server-side) legacy table populated by a MySQL query that runs on page load or if triggered by several search boxes (text-input fields). Recently, when the query runs, the table is defaulting to page 10, regardless of whether there are 10 pages of data or not, often making the table appear empty unless the end-user notices it's on the wrong page.

I've added event handlers to the search boxes to try to force the table to default to page 1 when the query is run via one of these fields, which mostly works, although if the same search box is changed twice in a row, often on the second change, page 2 of the table is selected instead of page 1, but I'd like to stop this behaviour altogether and just have the table default to page 1 unless a row is selected.

This has been going on at least since I updated our on-premises version to 3.8.4, though it may have also been happening previously and just not been reported by the end-users.

Any idea what's causing this and how to prevent it from happening?

Hey there! Would you mind sharing a screenshot of how your event handlers are forcing your table to page 1? A screen recording of this overall setup + unexpected behavior would also be great!

eventHandler-SelectPage
This is the event handler that I am using to force the table to select the first page when searching using a text input field. I have four of these search fields and any combination of them can filter the table data.

I'm not able to record my screen at the moment, but I believe I've found the source of the problem. I had a query to find and select the last updated row, which was meant to run only after an upsert query, but which was set to run automatically when inputs changed. I've set it to run only when manually triggered and it appears to have fixed the problem.