WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#38782 new defect (bug)

Insert/Edit link scrolling triggers AJAX requests for both (recent and search) rivers

Reported by: david.binda Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Editor Keywords:
Focuses: ui, performance Cc:
PR Number:

Description

I noticed quite a number of insert/edit link related SQL queries. When testing the feature, I have noticed that in case a search keywords is typed into the search field and user scrolls down the results, not only the search river related AJAX is made, but also a recent river triggers an AJAX request.

The behaviour currently looks this way:

1) opening the Insert/Edit link modal triggers following AJAX request:

action: wp-link-ajax
page: 1

2) putting in a keyword to search input triggers following AJAX request:

action: wp-link-ajax
page: 1
search: {keyword}

3) scrolling down the results of the search query produces two AJAX request:

action: wp-link-ajax
page: 2

and

action: wp-link-ajax
page: 2
search: {keyword}

4) as the search AJAX for page 2 returned false, scrolling up produces following AJAX only:

action: wp-link-ajax
page: 3

5) removing the keyword form the search input user is taken to the recent river which now already contains 4 pages of results

Since this behaviour is producing a lot of SQL queries with an increasing offset, those queries are getting slow with increasing dataset. Shouldn't the implementation be triggering AJAX requests for visible river only?

Attachments (1)

38782.patch (469 bytes) - added by david.binda 3 years ago.
Patch for querying results for visible river only

Download all attachments as: .zip

Change History (1)

@david.binda
3 years ago

Patch for querying results for visible river only

Note: See TracTickets for help on using tickets.